I have the following elements:
.nav {
width: 100%;
background: red;
display: flex;
}
.parent {
background: blue;
flex-grow: 1
}
.child {
background: yellow;
}
<div class="nav.">
<div class="parent">
<div class="child">
Logo
</div>
</div>
</div>
I want the Logo to be colored in Yellow, but I also want to see the color of the parent, blue color.
which basically means, I don't want the .child
to take up the width of its parent, I want it to have its own width depending on its content.
depending on its content means that I don't want to give it static width such as 100px or 200px, I want instead it to have a dynamic width.
How to achieve that in CSS?