Wrap both records in a div with the same class (for example, “subtitle”) and place them to the left with a width of 50%:
.sub-entry {
width: 50%;
float: left;
}
.button {
text-align: center;
padding-top: 20px;
clear: both;
}
<form class="form-validation" method="post" action="script.php">
<link rel="stylesheet" href="test.css">
<div class="sub-entry">
<h2>Person 1:</h2>
<br>
<div class="form-row form-input-name-row">
<label>
<span>Name</span>
<input name="field1" type="text">
</label>
</div>
<div class="form-row form-input-name-row">
<label>
<span>Age</span>
<input name="field2" type="text">
</label>
</div>
</div>
<div class="sub-entry">
<div class="main-content">
<h2>Person 2:</h2>
<br>
<div class="form-row form-input-name-row">
<label>
<span>Name</span>
<input name="field3" type="text">
</label>
</div>
<div class="form-row form-input-name-row">
<label>
<span>Age</span>
<input name="field4" type="text">
</label>
</div>
</div>
</div>
</form>
<div class="button">
<button name="submit">Submit both forms</button>
</div>
Run codeHide resultNotice, I also gave the div containing the button the class button, and injected it into the center of the form.
source
share