Currently, I am new to HTML and facing an issue with the display
style:
I want to create two checkboxes in a single line with a label in front of each. However, using the syntax below, my checkboxes always appear vertically (one above the other).
<div>
<label></label>
<div><input type='checkbox'></div>
<label></label>
<div><input type='checkbox'></div>
</div>
I know that using display:inline
can solve this issue. But when I try to add it to all elements within the outer <div>
, it doesn't work as expected. I'm unsure of what I might be missing. Could there be something I overlooked?
Additionally, if I wish for both checkboxes to be on the same line and floated to the left, should I simply add float:left
to each element within the outer <div>
? This approach seems inefficient especially if there are many elements within the outer <div>
.
Any assistance or guidance would be greatly appreciated!