first
valuevalue
I have one requirement, where I need to apply width to the parent element which is equal to the first child element\'s width. This can be easily achieved using display
I got the solution!!
HTML
first
valuevalue
CSS
.main {
overflow:hidden;
width:1px;
display:table;
background-color: cornflowerblue;
}
.first {
width: 50px; /* I don't know this width */
height: 50px; /* I don't know this height */
background-color: grey;
display: inline-block;
}
.value {
word-break: break-all;
}
Working Fiddle
Related link