Note: Since I have been trying to extract the code from a wordpress environment Salient theme, I have not been able to reproduce the issue in it's simplest form yet, I may end up answering my own question but please be aware that I appreciate any feedback along the way and I hope this question will be informative to the community.
My issue thus far is decribed below:
I am trying to gain better control over the way my content is displayed on the screen and there appear to be something I'm not understanding about CSS. I have tried using the "box-sizing: border box" property which includes padding and borders in the calculation of the total width of an element. I have added links to show the state of the input and span elements
"Chrome Devtool" Input element highlights
"Chrome Devtool" Span element content area
I assume box-sizing doesn't work because the issue is a margin related issue. My best guess is that the "margin-left" property has affected the total content area, pushing the content outside of the span element. However I want the input element to be contained inside the span element
HTML and CSS addition with thanks from Lucien Dubois
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
.contact-fields input, textarea{
margin-left: 12px;
}
.wpcf7-form-control-wrap {
display: block !important;
position: relative;
}
div, span, h5, p {
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
outline: 0;
padding: 0;
margin-right: 0;
border: 0
}
h5
{
font-family:Raleway;
line-height:16px;
margin-bottom: 7px;
color:#444;
letter-spacing:0px;
font-weight:600;
}
.form-label {
clear: both;
font-size: 20px
}
h5 {
vertical-align: baseline;
font-style: inherit;
outline: 0;
padding: 0;
margin-top: 0;
margin-right: 0;
margin-left: 0;
border:0
}
.first-name, .last-name {
display: inline-block;
width: 40%;
margin-right: 9px;
}
.first-name input, .last-name input {
width: 62%;
}
input {
margin-bottom: 20px;
margin-top: 5px;
}
<div class="contact-fields">
<div class="name-section">
<div class="first-name">
<h5 class="form-label"> First Name:</h5>
<p>
<span class="wpcf7-form-control-wrap fname">
<input type="text"
name="fname"
value=""
size="40"
maxlength="50"
class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required input-field"
aria-required="true"
aria-invalid="false">
</span>
</p>
</div>
<div class="last-name">
<h5 class="form-label"> Surname:</h5>
<p>
<span class="wpcf7-form-control-wrap lname">
<input type="text"
name="lname"
value=""
size="40"
maxlength="50"
class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required input-field"
aria-required="true"
aria-invalid="false"></span>
</p>
</div>
</div>
</div>