After formatting my HTML code as shown below:
https://i.sstatic.net/oaVVg.png
The blue rectangle takes up 70% of the outer container's width, while the green rectangle occupies the remaining 30%.
My goal is to have the blue rectangle expand to fill the entire width of the outer div when the green rectangle is set to display:none. I'm aiming for a layout like this:
https://i.sstatic.net/huNa4.png
Currently, when I hide the green rectangle div, the display looks like this:
https://i.sstatic.net/eiq3n.png
Any assistance on achieving this would be greatly appreciated.
html, body {
height: 100%;
}
#outer {
border: 1px solid black;
height: 20%;
width: 50%;
display:flex;
}
#inner_long {
width: 70%;
background-color: blue;
}
#inner_short {
width: 30%;
background-color: green;
/*display:none;*/
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href = "style.css">
<title>Document</title>
</head>
<body>
<div id = "outer">
<div id = "inner_long">
</div>
<div id = "inner_short">
</div>
</div>
</body>
</html>