html - 3 dynamic divs inside a parent div with fixed size -
i'm having trouble here, trying create 3 divs varying width inside parent div of fixed width. there anyway have divs adjust based on how space in there? 3 divs have varying size , needs fill parent div. divs need on same line. height not issue.
something this:
<div id="parent"> <div></div> <div></div> <div></div> </div>
flexbox rescue!
for example, used justify-content: space-between, there lot of different options.
#parent { width: 300px; background-color: orange; display: flex; justify-content: space-between; } .grow { flex-grow: 1; background-color: yellow; } <div id="parent"> <div>one</div> <div class="grow">two</div> <div>three</div> </div>
Comments
Post a Comment