I have an html form with several input fields that aligned using grid.
div.settings {
display:grid;
grid-template-columns: max-content max-content;
grid-gap:5px;
}
div.settings label { text-align:left; font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold }
div.settings label:after { content: " "; }
<form id="form_nav" action="/users/new_supplier" method="post">
<div class="settings" style="padding: 2%">
<label for="sc_suppllier_id">Supllier ID</label> <input id="sc_supplier_id" type="text" />
<label for="sc_supplier_name">Name</label> <input id="sc_supplier_name" type="text" style="width: 200%"/>
<label for="sc_supplier_phone">Phone</label> <input id="sc_supplier_phone" type="text"/>
</div>
</form>
I would like to put a check box 'Active" on the same line as Supplier ID.
<input type="checkbox" name="active" value="active"> Active.
But can't do it without messing up alignments. Any help is greatly appreciated. Thanks in advance
After some trial and error i got it.
div.settings {
display:grid;
grid-template-columns: max-content max-content;
grid-gap:5px;
}
div.settings label { text-align:left; font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold }
div.settings label:after { content: " "; }
<form id="form_nav" action="/users/new_supplier" method="post">
<div class="settings" style="padding: 2%">
<label for="sc_suppllier_id">Supllier ID</label> <a> <input id="sc_supplier_id" type="text"/> <input type="checkbox" id="sc_active"/> <label for="sc_active">Active</label> </a>
<label for="sc_supplier_name">Name</label> <input id="sc_supplier_name" type="text" style="width: 200%"/>
<label for="sc_supplier_phone">Phone</label> <input id="sc_supplier_phone" type="text"/>
</div>
</form>