JSFiddle - React, Tailwind, and code Playground

by Romanzes

HTML

<html>

  <head>
  </head>

  <body>
    <div class="parent">
      <div class="slave">Child that shouldn't dictate the width to anybody at all even though it's long</div>
      <br>
      <div class="master">Child that dictates the width to the parent and siblings</div>
    </div>
  </body>

</html>

CSS

.parent {
  background-color: green;
  display: inline-block;
}

.slave {
  background-color: blue;
  color: red;
  width: auto;
  height: 40px;
}

.master {
  background-color: red;
  color: black;
  width: auto;
  height: 40px;
}