Background information: I’m doing a challenge to practice my web development skills. Basically, what I’m doing is building snippets of a website in my own way by using HTML, CSS, and sometimes Javascript. For example, I remade the CDC’s Body Mass Index calculator from scratch. Here’s how it’s suppose to look like:
Here’s what I have: https://codepen.io/Aclixion/pen/mdqeBRO
My question involves the first two divs with the entries
class. Here are what I’m referring to:
<div class="entries">
<div class="field">
<label for="feet">Feet</label>
<input id="feet" type="number">
</div>
<div class="field">
<label for="inches">Inches</label>
<input id="inches" type="number">
</div>
</div>
<div class="entries">
<div class="pounds">
<div class="field">
<label for="pounds">Pounds</label>
<input id="pounds" type="number">
</div>
</div>
</div>
Here’s a picture of what I want this section to look like (Which is what I have now for the “heights” section):
Here is my current styling for them:
.entries {
display: flex;
gap: 10px;
margin-left: 10px;
}
.entries input {
display: block;
width: 75px;
}
Here’s what the styles look like with flexbox:
.entries {
display: flex;
gap: 10px;
margin-left: 10px;
}
.field {
display: flex;
flex-direction: column;
}
.field input {
width: 75px;
}
Note: The first selector didn’t change in both the current styling and the one with flex
Right now, I’m having trouble deciding whether or not to use flex containers for the divs with the field
class. I thought about using flex containers because it can help simplify positioning the elements to my liking. At the same time, I can get the result I want without using flexbox. Should I use flexbox or should I not? What else should I change?