I have a div that looks like this:
I would like to somehow make the inputs always stretch to the end of the div. The desired result is:
It seems from the research I did that adding display: flex
and flex-wrap: wrap
to the div will be necessary, but I couldn't get it to layout as desired. Any help on how to make the inputs always stretch to the end of the div will be appreciated.
If the input breaks to own line that's fine. I just want it to stretch to the end of the div.
Code snippet to follow -
.square:nth-child(odd) {
background: rgb(220, 217, 217);
}
.container {
display: grid;
grid-template-columns: repeat(3, 33%);
column-gap: .5%;
}
.square {
padding: 4px;
border: 1px solid red;
}
.square input {
}
<!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="styles.css">
<title>Document</title>
</head>
<body>
<div class="container">
<div class="square one">
<label for="numSelect">Choose an algorithm:</label>
<input type="text" id="numSelect">
<label for="arr">Array:</label>
<input type="text" id="arr">
</div>
<div class="square 2">
<p>buncha text</p>
</div>
<div class="square 3">
<p>buncha text</p>
</div>
<div class="square 4">
<p>buncha text</p>
</div>
<div class="square 5">
<p>buncha text</p>
</div>
<div class="square 6">
<p>buncha text</p>
</div>
</div>
</body>
</html>