I want the children of the div
fill its width.
now am using a code like this:
You can use flexbox to achieve this.
The demo below shows how it works with more child nodes and also with nodes with zero height.
I have also changed the margin property for the child items to work properly with flexbox.
.parent {
width: 100%;
display: inline-flex; /*used inline-flex here, to mirrior your inline-block setting, but you can use flex*/
height: 120px;
background: #000;
padding: 10px;
box-sizing: border-box;
}
.child {
display: inline-flex;
flex-grow: 1;
margin: 0 1%;
height: 100px;
background: #ffffd;
}
/*demontration for zero-height child elements*/
.child:nth-child(2) {
height: 0;
}