I am currently working on customizing a form layout provided by a client that has the following structure:
<div class="formRow">
<div class="fieldName">
Email
</div>
<div class="fieldInput">
<input .../>
</div>
</div>
The width of the form is set to 500px, however, the fieldName div and fieldInput div are not displaying side by side as intended but rather stacked on top of each other. This issue seems to be caused by the right margin of the fieldName div being computed at 340px, which occupies the full width of the form in Chrome and Firefox.
Despite my attempts to override this behavior by setting a margin-right of 10px or adjusting the width of the div, I have been unsuccessful. Modifying the width of the div only affects its inner space, leaving the strange right-margin unchanged.
What CSS challenge am I facing here?
For reference, below is the current CSS styling for the elements:
.formRow{
padding: 3px 0 3px 0;
position: relative;
height: auto;
width: 100%;
}
.fieldName{
font-size: 12px;
margin-left: 10px;
margin-right: 10px;
width: 100px;
}
.fieldInput{
width: 200px;
}