Your label is enclosed in a div, but your input element is located outside of the div. To correct this, simply move the closing </div>
tag after the <input ... />
tag.
Remember, DIVs act as containers on a webpage and having multiple containers can help organize the page layout effectively.
To optimize this div, you may consider adding display:flex
to it:
<div key={item.ITEM} style={{display:flex}}>
This will ensure that everything appears on a single line. Keep in mind that flexbox affects only the immediate children of an element, and any element can be both a flex-child and a flex-parent simultaneously. (Note: The usage of the flex-child class below is for illustrative purposes only)
.flex-parent{display:flex;}
.flex-child{} /* Not necessary */
#red{background:red;}
#green{background:green;}
#blue{background:blue;}
#gold{background:gold;}
#sam{width:100px;justify-content:center;}
div{padding:10px;}
.half{width:50%;}
<div class="flex-parent">
<div class="flex-parent flex-child" id="red">
<div class="half flex-child">Bob</div>
<div class="half flex-child">Sue</div>
</div>
<div class="flex-child" id="blue"></div>
<div class="flex-child" id="green"></div>
<div class="flex-parent flex-child" id="gold">
<div class="flex-child" id="sam">Sam</div>
</div>
</div>
For further guidance on utilizing flexbox efficiently, check out these helpful links. Learning flexbox is simpler than you think!
Best way to attach icon left to a text
How do I center child div in parent and have it fixed to the top?