I've created a flex box container and 3 child div
s in it and
I want to keep the sizes of the 3 in same the same ratio (1:1:1)
but when I add some text into the child div
s, they change ratio to cover up for the text overflow
Like this:
#container
{
display: flex;
width: 100%;
height: 100px;
text-align: center;
}
.item
{
color: white;
flex-grow:1;
}
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
before text:
<div id="container">
<div class="item" style="background-color:red;"></div>
<div class="item" style="background-color:green;"></div>
<div class="item" style="background-color:blue;"></div>
</div>
<br>
after text:
<div id="container">
<div class="item" style="background-color:red;">hello there</div>
<div class="item" style="background-color:green;">hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii</div>
<div class="item" style="background-color:blue;">no</div>
</div>
</body>
</html>
so how do I maintain the aspect ratio while adding text?
NOTE:
hiding the overflow is acceptable