Read-only form alignment needs to be consistent - html

I have a bit of an issue getting some of my form inputs to align well because they are read-only and hence do not take the same dimensions as the actual visible inputs. I've supplied two images to help you see:
UNALIGNED FORM SECTON
ALIGNED FORM SECTION
label[class="statlabel"] {
font-family: "Amaranth", sans-serif;
display: inline-block;
float: left;
width: 250px;
text-align: right;
padding-right: 10px;
clear: left;
padding-top: 15px;
}
.input CSS
.input {
font-size: 20px;
color: #5a5854;
background-color: #f2f2f2;
border: 1px solid #bdbdbd;
border-radius: 3px;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
padding: 5px 5px 5px 30px;
background-repeat: no-repeat;
background-position: 8px 9px;
display: inline-block;
margin-bottom: 10px;
text-indent: 15px;
width: 250px;
}
<a name="personalInfo"></a>
<h5 class="stath5"><span class="badge badge-secondary">2.</span> Please review your personal information</h5>
<EditForm Model="#Data.PersonalInfo" style="max-width:800px;" onkeydown="javascript: DisableEnterKey();">
<label id="fullNameLabel" class="statlabel" for="fullName">Full name:</label>
<span class="nameLabel"><label id="fullName">#Data.PersonalInfo.FullName</label></span>
<br />
<label id="statusLabel" class="statlabel" for="communityStatus">Spanish Lookout Community status:</label>
<span class="statuslabel"><label id="slcStatus">#Data.PersonalInfo.SLCStatus</label></span>
<br />
<label id="boxNumLabel" class="statlabel" for="boxNum">Box Number:</label>
<span class="boxLabel"><label id="boxNum">#Data.PersonalInfo.BoxNumber</label></span>
<br />
<div class="input-container">
<label class="statlabel" for="phone">Phone Number:</label>
<InputText type="tel" id="phone" class="input" #bind-Value="#Data.PersonalInfo.Phone" placeholder="What's your phone number?" />
</div>
<br /><hr class="statHR" />
<div class="input-container1">
<label class="statlabel" for="email">Email <span class="badge badge-success">Optional</span>:</label>
<InputText type="email" id="email" class="input" #bind-Value="#Data.PersonalInfo.Email" placeholder="What's your email address?" />
</div>
</EditForm>
</div>
To clarify, I want the first image to look like the second image. Any help would be invaluable. Thanks for your time!

this should get you started. Use Flex!
.row{
display:flex;
align-items:center;
border:solid black 1px;}
label{
width:25vw;}
EditForm{
display:flex;
flex-direction:column;
}
hr{
width:100%;}
<a name="personalInfo"></a>
<h5 class="stath5"><span class="badge badge-secondary">2.</span> Please review your personal information</h5>
<EditForm Model="#Data.PersonalInfo" style="max-width:800px;" onkeydown="javascript: DisableEnterKey();">
<div class='row'>
<label id="fullNameLabel" class="statlabel" for="fullName">Full name:</label>
<span class="nameLabel"><label id="fullName">#Data.PersonalInfo.FullName</label></span>
</div>
<div class='row'>
<label id="statusLabel" class="statlabel" for="communityStatus">Spanish Lookout Community status:</label>
<span class="statuslabel"><label id="slcStatus">#Data.PersonalInfo.SLCStatus</label></span>
</div>
<div class='row'>
<label id="boxNumLabel" class="statlabel" for="boxNum">Box Number:</label>
<span class="boxLabel"><label id="boxNum">#Data.PersonalInfo.BoxNumber</label></span>
</div>
<div class='row'>
<div class="input-container">
<label class="statlabel" for="phone">Phone Number:</label>
<input type="tel" id="phone" class="input" #bind-Value="#Data.PersonalInfo.Phone" placeholder="What's your phone number?" />
</div></div>
<div class='row'>
<hr class="statHR" />
</div>
<div class='row'>
<div class="input-container1">
<label class="statlabel" for="email">Email <span class="badge badge-success">Optional</span>:</label>
<input type="email" id="email" class="input" #bind-Value="#Data.PersonalInfo.Email" placeholder="What's your email address?" />
</div>
</div>
</EditForm>
</div>

Related

Prevent input data from showing in url - Flask

I am gathering customer data from a web app - however once data is input the data displays in the URL search bar and I am just wondering about how to prevent that from happening?
here is my current code:
<form>
<div class="row">
<div class="col-75">
<div class="container">
<form action="/action_page.php", method="POST">
<div class="row">
<div class="col-50">
<h3>Billing Address</h3>
<label for="fname"><i class="fa fa-user"></i> Full Name</label>
<input type="text" id="fname" name="firstname" placeholder="John M. Doe">
<label for="email"><i class="fa fa-envelope"></i> Email</label>
<input type="text" id="email" name="email" placeholder="john#example.com">
<label for="adr"><i class="fa fa-address-card-o"></i> Address</label>
<input type="text" id="adr" name="address" placeholder="1234 Example Street, Richmond">
<label for="city"><i class="fa fa-institution"></i> Suburb</label>
<input type="text" id="city" name="city" placeholder="Melbourne">
<div class="row">
<div class="col-50">
<label for="state">State</label>
<input type="text" id="state" name="state" placeholder="Victoria">
</div>
<div class="col-50">
<label for="postcode">Post Code</label>
<input type="text" id="postcode" name="postcode" placeholder="3934">
</div>
</div>
</div>
<div class="col-50">
<h3>Payment</h3>
<label for="fname">Accepted Cards</label>
<div class="icon-container">
<i class="fa fa-cc-visa" style="color:navy;">Visa</i>
<i class="fa fa-cc-amex" style="color:blue;">Amex</i>
<i class="fa fa-cc-mastercard" style="color:red;">Mastercard</i>
</div>
<label for="cname">Name on Card</label>
<input type="text" id="cname" name="cardname" placeholder="John More Doe">
<label for="ccnum">Credit card number</label>
<input type="text" id="ccnum" name="cardnumber" placeholder="1111-2222-3333-4444">
<label for="expmonth">Exp Month</label>
<input type="text" id="expmonth" name="expmonth" placeholder="September">
<div class="row">
<div class="col-50">
<label for="expyear">Exp Year</label>
<input type="text" id="expyear" name="expyear" placeholder="2018">
</div>
<div class="col-50">
<label for="cvv">CVV</label>
<input type="text" id="cvv" name="cvv" placeholder="352">
</div>
</div>
</div>
</div>
<label>
<input type="checkbox" checked="checked" name="sameadr"> Shipping address same as billing
</label>
<input type="submit" value="Continue to checkout" class="btn">
</form>
</div>
</div>
.row {
display: -ms-flexbox; /* IE10 */
display: flex;
-ms-flex-wrap: wrap; /* IE10 */
flex-wrap: wrap;
margin: 0 -16px;
}
.col-25 {
-ms-flex: 25%; /* IE10 */
flex: 25%;
}
.col-50 {
-ms-flex: 50%; /* IE10 */
flex: 50%;
}
.col-75 {
-ms-flex: 75%; /* IE10 */
flex: 75%;
}
.col-25,
.col-50,
.col-75 {
padding: 0 16px;
}
.container {
background-color: #f2f2f2;
padding: 5px 20px 15px 20px;
border: 1px solid lightgrey;
border-radius: 3px;
}
input[type=text] {
width: 100%;
margin-bottom: 20px;
padding: 12px;
border: 1px solid #ccc;
border-radius: 3px;
}
label {
margin-bottom: 10px;
display: block;
}
.icon-container {
margin-bottom: 20px;
padding: 7px 0;
font-size: 24px;
}
.btn {
background-color: #04AA6D;
color: white;
padding: 12px;
margin: 10px 0;
border: none;
width: 100%;
border-radius: 3px;
cursor: pointer;
font-size: 17px;
}
.btn:hover {
background-color: #45a049;
}
span.price {
float: right;
color: grey;
}
/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top of each other instead of next to each other (and change the direction - make the "cart" column go on top) */
#media (max-width: 800px) {
.row {
flex-direction: column-reverse;
}
.col-25 {
margin-bottom: 20px;
}
}
Any help would be really appreciated :)
You have an unnecessary <form> tag on the first line of your HTML and you are missing a closing </div> tag at the end. Changing this seems to resolve the issue:
<div class="row">
<div class="col-75">
<div class="container">
<form action="/action_page.php" , method="POST">
<div class="row">
<div class="col-50">
<h3>Billing Address</h3>
<label for="fname"><i class="fa fa-user"></i> Full Name</label>
<input type="text" id="fname" name="firstname" placeholder="John M. Doe">
<label for="email"><i class="fa fa-envelope"></i> Email</label>
<input type="text" id="email" name="email" placeholder="john#example.com">
<label for="adr"><i class="fa fa-address-card-o"></i> Address</label>
<input type="text" id="adr" name="address" placeholder="1234 Example Street, Richmond">
<label for="city"><i class="fa fa-institution"></i> Suburb</label>
<input type="text" id="city" name="city" placeholder="Melbourne">
<div class="row">
<div class="col-50">
<label for="state">State</label>
<input type="text" id="state" name="state" placeholder="Victoria">
</div>
<div class="col-50">
<label for="postcode">Post Code</label>
<input type="text" id="postcode" name="postcode" placeholder="3934">
</div>
</div>
</div>
<div class="col-50">
<h3>Payment</h3>
<label for="fname">Accepted Cards</label>
<div class="icon-container">
<i class="fa fa-cc-visa" style="color:navy;">Visa</i>
<i class="fa fa-cc-amex" style="color:blue;">Amex</i>
<i class="fa fa-cc-mastercard" style="color:red;">Mastercard</i>
</div>
<label for="cname">Name on Card</label>
<input type="text" id="cname" name="cardname" placeholder="John More Doe">
<label for="ccnum">Credit card number</label>
<input type="text" id="ccnum" name="cardnumber" placeholder="1111-2222-3333-4444">
<label for="expmonth">Exp Month</label>
<input type="text" id="expmonth" name="expmonth" placeholder="September">
<div class="row">
<div class="col-50">
<label for="expyear">Exp Year</label>
<input type="text" id="expyear" name="expyear" placeholder="2018">
</div>
<div class="col-50">
<label for="cvv">CVV</label>
<input type="text" id="cvv" name="cvv" placeholder="352">
</div>
</div>
</div>
</div>
<label>
<input type="checkbox" checked="checked" name="sameadr"> Shipping address same as billing
</label>
<input type="submit" value="Continue to checkout" class="btn">
</form>
</div>
</div>
</div>
(Note: my editor may have formatted your code differently to the original question)

How to center button and placeholder's text vertically

I have a problem, I used bootstrap to make a website and used its input and button classes, of course as I can see that's not the problem in bootstrap. I don't know how to center placeholder/input text and button text vertically. I read about line-height but it didn't help me.
BUTTONS:
<a
href="#"
class="button-early-access btn bg-dark"
>Early access</a
>
INPUTS:
<form>
<div class="form-group">
<input
type="text"
class="form-control p-20 col-md-12"
id="firstLastName"
aria-describedby="firstLastNameFan"
placeholder="First and last name"
/>
</div>
<div class="form-group">
<input
type="email"
class="form-control col-md-12"
id="exampleInputEmail1"
aria-describedby="emailHelpFan"
placeholder="Enter email"
/>
</div>
<div class="form-group">
<input
type="text"
class="form-control"
id="teamFan"
placeholder="What is your favorite sports team?"
/>
</div>
<div class="form-group">
<input
type="text"
class="form-control"
id="topAthlete"
placeholder="Name one athlete you would like to meet?"
/>
</div>
<button type="submit" class="btn button-early-access">
Submit
</button>
</form>
.button-early-access {
background: linear-gradient(266.81deg, #009ebe -3.26%, #049c69 92.97%);
border-radius: 27px;
font-weight: bold;
color: white;
padding: 11px 35px;
}
.form-group input {
text-indent: 20px;
width: 100%;
/* min-width: 726px; */
font-size: 2em;
}
Try a different font besides Khula. That font has a lot of space for descenders, which is likely what you are seeing.
If you still want to use that font you have to correct the vertical inequality with padding.
.button-early-access {
background: linear-gradient(266.81deg, #009ebe -3.26%, #049c69 92.97%);
border-radius: 27px;
font-weight: bold;
color: white;
padding: 11px 35px 7px;
font-family: 'Khula', sans-serif;
}
.form-group input {
font-family: 'Khula', sans-serif;
text-indent: 20px;
width: 100%;
font-size: 2em;
padding-top: 8px;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Khula:wght#300;700&display=swap" rel="stylesheet">
<form>
<div class="form-group">
<input
type="text"
class="form-control p-20 col-md-12"
id="firstLastName"
aria-describedby="firstLastNameFan"
placeholder="First and last name"
/>
</div>
<div class="form-group">
<input
type="email"
class="form-control col-md-12"
id="exampleInputEmail1"
aria-describedby="emailHelpFan"
placeholder="Enter email"
/>
</div>
<div class="form-group">
<input
type="text"
class="form-control"
id="teamFan"
placeholder="What is your favorite sports team?"
/>
</div>
<div class="form-group">
<input
type="text"
class="form-control"
id="topAthlete"
placeholder="Name one athlete you would like to meet?"
/>
</div>
<button type="submit" class="btn button-early-access">
Submit
</button>
<a
href="#"
class="button-early-access btn bg-dark"
>Early access</a
>
</form>

Why is the "required" HTML attribute is not working?

As the heading suggests, the required attribute is not working, so I cannot seem to be able to validate my form.
I am creating an event registration form.
I have tried encapsulating each element inside form,but that doesn't seem to work.
What can I do to help with that? Please excuse me if the question is childish. I am a beginner, and I am trying to practice as much as I can.
......................................................................................................................................................
<html>
<head>
<style>
* {
box-sizing: border-box;
}
text-danger {
color: #e74c3c;
}
input[type=text], select, textarea {
width: 100%;
padding: 12px;
border: 1px solid #ccc;
border-radius: 4px;
resize: horizontal;
}
legend {
font: bold 1.0em Arial, Helvetica, sans-serif;
color: #00008B;
background-color: #FFFFFF;
}
label {
padding: 12px 12px 12px 0;
display: inline-block;
}
input[type=submit] {
background-color: #4CAF50;
color: white;
padding: 12px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
float: right;
}
input[type=submit]:hover {
background-color: #45a049;
}
.container {
border-radius: 5px;
background-color: #f2f2f2;
padding: 20px;
}
fieldset {
border: 1px solid #61B5CF;
margin-top: 1.4em;
padding: 0.6em;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout - when the screen is less than 600px wide, make the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 600px) {
.col-25, .col-75, input[type=submit] {
width: 100%;
margin-top: 0;
}
}
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
/* Hide default HTML checkbox */
.switch input {
opacity: 0;
width: 0;
height: 0;
}
/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
input:not([type=submit]):invalid {
background-color: #ffdddd;
}
input:not([type=submit]):valid {
background-color: #ddffdd;
}
input:not([type=submit]):invalid:required {
background: #ffdddd url('http://www.developerdrive.com/wp-content/uploads/2013/08/asterisk1.png') no-repeat right top;
}
input:not([type=submit]):valid:required {
background: #ddffdd url('http://www.developerdrive.com/wp-content/uploads/2013/08/asterisk1.png') no-repeat right top;
}
input:not([type=submit]):optional {
background-color: #add1ef;
}
/* Rounded sliders */
.slider.round {
border-radius: 34px;
}
.slider.round:before {
border-radius: 50%;
}
</style>
</head>
<body>
<div class="container">
<h2> WIE ILS'19 Registration</h2>
<form novalidate="">
<fieldset>
<legend>Login Details</legend>
<div class="form-group">
<label class="col-md-2 control-label">E-Mail</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-envelope"></i></span>
<input name="email" placeholder="E-Mail Address" class="form-control" type="text" required>
</div>
</div>
</div>
<br></br>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" >Password</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="password" name="password" id="password" onchange='check_pass();' required>
</div>
</div>
</div>
<br></br>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label" >Confirm Password</label>
<div class="col-md-4 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input type="password" name="confirm_password" id="confirm_password" onchange='check_pass();' required>
</div>
</div>
</div>
<br></br>
</form>
</fieldset>
<form>
<fieldset>
<legend>Personal Information</legend>
<form>
<div class="form-group">
<label class="col-xs-2 control-label">First Name</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="first_name" placeholder="First Name" class="form-control" type="text" required>
</div>
</div>
</div>
</form>
<br></br>
<!-- Text input-->
<form>
<div class="form-group">
<label class="col-xs-2 control-label" >Last Name</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="last_name" placeholder="Last Name" class="form-control" type="text" required>
</div>
</div>
</div>
</form>
<br></br>
<!-- Text input-->
<form>
<div class="form-group">
<label class="col-md-2 control-label">Contact No.</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-earphone"></i></span>
<input name="contact_no" placeholder="(+92)" class="form-control" type="text" required>
</div>
</div>
</div>
</form>
<br></br>
<form>
<div class="form-group">
<label class="col-md-2 control-label">CNIC No.</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="contact_no" placeholder="No-Hyphens" class="form-control" type="text" id="message" required>
<p class="help-block text-danger"></p>
</div>
</div>
</div>
</form>
<br></br>
</fieldset>
</form>
<form novalidate="">
<fieldset>
<legend>Education Details</legend>
<form>
<div class="form-group">
<label class="col-xs-2 control-label">University/Institute</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-education"></i></span>
<input name="first_name" placeholder="Institute Name" class="form-control" type="text" required>
</div>
</div>
</div>
</form>
<br></br>
<!-- Text input-->
<div class="form-group">
<label class="col-xs-2 control-label" >Degree Program </label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
<input name="last_name" placeholder="Last Name" class="form-control" type="text" required>
</div>
</div>
</div>
<br></br>
<!-- Text input-->
<div class="form-group">
<label class="col-md-2 control-label">Semester</label>
<div class="col-md-3 inputGroupContainer">
<div class="input-group">
<span class="input-group-addon"><i class="glyphicon glyphicon-tasks"></i></span>
<input name="contact_no" placeholder="" class="form-control" type="text" required>
</div>
</div>
</div>
<br></br>
</fieldset>
</form>
<form novalidate="">
<h5 style="font-weight:bold" >Do you need accomodation?</h5>
<label class="switch">
<input type="checkbox">
<span class="slider round"></span>
</label>
<br>
<br>
<button type="submit" name="submit" value="registration" id="submit" disabled>Submit</button>
</div>
</form>
<script >
function check_pass() {
if (document.getElementById('password').value ==
document.getElementById('confirm_password').value) {
document.getElementById('submit').disabled = false;
} else {
document.getElementById('submit').disabled = true;
}
}
</script>
</body>
</html>
In order for the submit to work, you need to put it inside of the form that you would like to submit. There are other ways of doing it, but that usually incorporates JavaScript and JQuery. The reason it is preventing you from submitting when it is inside the form though, is due to the novalidate attribute on the form. Just remove that and you should be good to go!
P.S. Even though the field is required on the front-end, that is all client side so it's not hard to go in and change it. It's always a good idea to validate it on the back-end as well. Think of the front-end as more of a suggestion and less of a final verdict.

Bootstrap form - scroll does not appear when screen is resized

I'm working on a project with a Bootstrap form. Very simply, I would like the form to have a scroll bar when the window is resized. I tried adding the overflow-auto class to my div, but that doesn't work for it. So when I resize my window, no scroll appears. Here's my code.
.form-container {
border-radius: 25px;
border: 1px solid black;
padding: 15px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.register-container { max-width: 500px; }
.title-header {
font-size: 25px;
font-weight: bold;
}
<div class="overflow-auto container form-container register-container">
<h1 class="title-header">REGISTER</h1>
<form id="register" method="post" action="register">
<?php writeMessageBoxIfMessage($message); ?>
<div class="form-group row">
<div class="col-sm-6">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">FIRST NAME</label> <br>
<input id="firstname" name="firstname" maxlength="80" required>
</div>
<div class="col-sm-6">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">LAST NAME</label> <br>
<input id="lastname" name="lastname" maxlength="80" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">EMAIL</label> <br>
<input type="email" id="email" name="email" maxlength="255" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">PASSWORD</label> <br>
<input type="password" id="password" name="password" maxlength="80" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">CONFIRM PASSWORD</label> <br>
<input type="password" id="confirm-password" name="confirm-password" maxlength="80" required>
</div>
<div class="col-sm-6">
Already have an account? <br> Click here</span> to login.
</div>
<div class="col-sm-6">
<input id="register" type="submit" name="submit"
value="REGISTER" />
</div>
</div>
</form>
</div>
Can anyone provide some suggestions so I can get this to scroll?
Can’t replicate this at the moment but try using
position: absolute;
and give a container
position: relative;
Rather than using the ‘fixed’ position.
Let me know if this doesn’t work.
I hope you want internal scroll if the form is more in height.
Use the following CSS,
Try it.
#register {
max-height: 200px;
overflow: scroll;
}
Please add media
#media (max-height: 420px) {
#register {
height: 150px;
overflow-x: hidden;
overflow-y: scroll;
}
}
for better solution and check your device height should be (max-height: yourDeviceHeight) in media
.form-container {
border-radius: 25px;
border: 1px solid black;
padding: 15px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.register-container { max-width: 500px; }
.title-header {
font-size: 25px;
font-weight: bold;
}
#media (max-height: 420px) {
#register {
height: 150px;
overflow-x: hidden;
overflow-y: scroll;
}
}
<div class="overflow-auto container form-container register-container">
<h1 class="title-header">REGISTER</h1>
<form id="register" method="post" action="register">
<?php writeMessageBoxIfMessage($message); ?>
<div class="form-group row">
<div class="col-sm-6">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">FIRST NAME</label> <br>
<input id="firstname" name="firstname" maxlength="80" required>
</div>
<div class="col-sm-6">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">LAST NAME</label> <br>
<input id="lastname" name="lastname" maxlength="80" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">EMAIL</label> <br>
<input type="email" id="email" name="email" maxlength="255" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">PASSWORD</label> <br>
<input type="password" id="password" name="password" maxlength="80" required>
</div>
<div class="col-sm-12">
<label for="colFormLabelSm" class="col-sm-12 col-form-label col-form-label-sm">CONFIRM PASSWORD</label> <br>
<input type="password" id="confirm-password" name="confirm-password" maxlength="80" required>
</div>
<div class="col-sm-6">
Already have an account? <br> Click here</span> to login.
</div>
<div class="col-sm-6">
<input id="register" type="submit" name="submit"
value="REGISTER" />
</div>
</div>
</form>
</div>

trouble aligning the divs and other inner tags at different positions

I'm creating my first ever html page, and I'm trying to do some alignment for divs and labels.
The labels and the input seem out of position even after spending multiple hours trying different combinations. Some properties are not working, like I used width for label and in chrome it says unknown property.
Below is the code. Any help with this would be appreciated.
Preview of the html/css part:
div.btn-toolbar {
position: relative;
top: 100px;
left: 40%;
width: 400px;
}
div.quote-details {
position: relative;
top: 122px;
left: 250px;
font-weight: bold;
font-size: 15px;
}
div.quote-detail-section-left {
float: left;
margin-top: 145px;
margin-left: 100px;
width: 35%;
}
input.quote-input {
padding: 4px;
}
label.field-label {
float: left;
font-weight: bold;
display: inline-block;
margin-left: 40px;
width: :50px;
clear: both;
}
div.quote-detail-section-right {
float: right;
margin-top: 145px;
margin-right: 80px;
width: 35%;
}
<div class="quote-rec-page">
<div class="quote-details">
<label for="section" class="Segment">Quote Details</label>
</div>
<div class="btn-toolbar">
<button type="button">Edit</button>
<button type="button">Delete</button>
<button type="button">Create PDF</button>
<button type="button">Email Quote</button>
<button type="button">Start Sync</button>
</div>
<form>
<div class="quote-detail-section-left">
<div>
<label for="quoteNum" class="field-label">Quote Number</label>
<input type="text" class="quote-input" tabindex="1" id="quoteNumber" />
</div>
<div>
<label for="quoteName" class="field-label">Quote Name</label>
<input type="text" class="quote-input" tabindex="2" id="quoteName" />
</div>
<div>
<label for="oppName" class="field-label">Opportunity Name</label>
<input type="text" class="quote-input" tabindex="3" id="oppName" />
</div>
<div>
<label for="accName" class="field-label">Account Name</label>
<input type="text" class="quote-input" tabindex="4" id="accName" />
</div>
</div>
<div class="quote-detail-section-right">
<div>
<label for="expDate" class="field-label">Expiration Date</label>
<input type="date" class="quote-input" tabindex="5" id="expDate" />
</div>
<div>
<label for="sync" class="field-label">Syncing</label>
<input type="checkbox" class="quote-input" tabindex="6" id="sync" />
</div>
<div>
<label for="status" class="field-label">Status</label>
<input type="text" class="quote-input" tabindex="7" id="status" />
</div>
<div>
<label for="quoteDesc" class="field-label">Description</label>
<input type="text" class="quote-input" tabindex="8" id="quoteDesc" />
</div>
</div>
</form>
</div>
Html/css including apex code:
<apex:page sidebar="false" showHeader="false">
<head>
<title>Quote Details</title>
</head>
<style>
div.btn-toolbar{
position:relative;
top:100px;
left:40%;
width:400px;
}
div.quote-details{
position:relative;
top:122px;
left:250px;
font-weight:bold;
font-size:15px;
}
div.quote-detail-section-left{
float:left;
margin-top : 145px;
margin-left: 100px;
width:35%;
}
input.quote-input{
padding:4px;
}
label.field-label{
float:left;
font-weight:bold;
display:inline-block;
margin-left : 40px;
width::50px;
clear:both;
}
div.quote-detail-section-right{
float:right;
margin-top : 145px;
margin-right: 80px;
width:35%;
}
</style>
<body>
<div class="quote-rec-page">
<div class = "quote-details">
<label for = "section" class="Segment">Quote Details</label>
</div>
<div class ="btn-toolbar">
<button type="button">Edit</button>
<button type="button">Delete</button>
<button type="button">Create PDF</button>
<button type="button">Email Quote</button>
<button type="button">Start Sync</button>
</div>
<form>
<div class ="quote-detail-section-left">
<div>
<label for="quoteNum" class ="field-label">Quote Number</label>
<input type="text" class="quote-input" tabindex="1" id="quoteNumber"/>
</div>
<div>
<label for="quoteName" class ="field-label">Quote Name</label>
<input type="text" class="quote-input" tabindex="2" id="quoteName"/>
</div>
<div>
<label for="oppName" class ="field-label">Opportunity Name</label>
<input type="text" class="quote-input" tabindex="3" id="oppName"/>
</div>
<div>
<label for="accName" class ="field-label">Account Name</label>
<input type="text" class="quote-input" tabindex="4" id="accName"/>
</div>
</div>
<div class ="quote-detail-section-right">
<div>
<label for="expDate" class ="field-label">Expiration Date</label>
<input type="date" class="quote-input" tabindex="5" id="expDate"/>
</div>
<div>
<label for="sync" class ="field-label">Syncing</label>
<input type="checkbox" class="quote-input" tabindex="6" id="sync"/>
</div>
<div>
<label for="status" class ="field-label">Status</label>
<input type="text" class="quote-input" tabindex="7" id="status"/>
</div>
<div>
<label for="quoteDesc" class ="field-label">Description</label>
<input type="text" class="quote-input" tabindex="8" id="quoteDesc"/>
</div>
</div>
</form>
</div>
</body>
</apex:page>