I have two divs
with width: 50%
and text content inside that are wrapped in the container. The problem is that when text content changes, width also changes:
I have a fixed width of the container equal to 200px
:
.container {
display: block;
width: 200px;
}
.text1 {
background-color: red;
width: 50%;
display: inline;
}
.text2 {
background-color: blue;
width: 50%;
display: inline;
}
<div class='container'>
<div class='text1'>Text1</div>
<div class='text2'>Text2</div>
</div>
How I can keep 50% of child div
width even when text is changing?
Link to JSFiddle: