CSS Div Alignment Compatibility - html

I am having some difficulty with the compatibility of my CSS for the HTML check boxes. For some versions of IE as well as when I place the live html into my PowerPoint, the center div will overlap with the left and the entire page is shifted left. I am not quite sure why this occurs.
html,
body {
height: 90%;
width: 90%;
padding: 5px;
margin: auto;
}
#googleMap {
height: 90%;
width: 90%;
padding: 5px;
margin: auto;
}
.Title {
font-size: 1.5em;
font-weight: bold;
text-align: center;
}
#left_check {
position: absolute;
left: 10%;
}
#padded-left {
position: absolute;
padding-left: 1.4em;
}
#right_check {
float: right;
}
#mid_check {
text-align: center;
margin-left: auto;
margin-right: auto;
}
#left_align {
display: inline-block;
text-align: left;
}
<ul style="list-style-type:none">
<div id="left_check">
<li>
<form>
<input id="united_states1" type="checkbox" name="location" value="united_states">United States (domestic)
<br>
<div id="padded-left">
<input id="west1" type="checkbox" class="location" value="west_coast">West
<br>
<input id="east1" type="checkbox" class="location" value="central_us">East
<br>
<input id="cent1" type="checkbox" class="location" value="east_coast">Central
</div>
</form>
</li>
</div>
<div id="right_check">
<li>
<form>
<input id="euro1" type="checkbox" class="location" value="europe">Europe
<br>
<input id="africa1" type="checkbox" class="location" value="africa">Africa
<br>
<input id="asia1" type="checkbox" class="location" value="asia">Asia
<br>
<input id="aust1" type="checkbox" class="location" value="australia">Australia
</form>
</li>
</div>
<div id="mid_check">
<div id="left_align">
<li>
<form>
<input id="canada1" type="checkbox" class="location" value="canada">Canada
<br>
<input id="centr_am1" type="checkbox" class="location" value="central_america">Central America
<br>
<input id="south_am1" type="checkbox" class="location" value="south_america">South America
<br>
<input id="ocean1" type="checkbox" class="location" value="oceanic">Oceanic
</form>
</li>
</div>
</div>
</ul>
Original CSS (Problems with some pc IE)
With Flex
IE Problems (new)

This is how you can do it, if I got your question right.
ul {
display: flex;
padding: 0px !important;
}
ul > div {
/* width: 30%; */
flex-grow: 1;
}
ul > div#right_check {
order: 3;
}
ul > div#mid_check {
order: 2;
}
ul > div#left_check {
order: 1;
}
div#mid_check li {
text-align: center;
}
div#right_check li form,
div#mid_check li form {
text-align: left;
}
div#right_check li {
text-align: right;
}
form {
height: 39px;
width: auto;
display: inline-block;
}
#map-canvas {
height: 500px;
width: 100%;
background: #AFAFAF;
}
div.frame {
width: 80%;
margin: auto;
}
<div class='frame'>
<div id="map-canvas"></div>
<ul style="list-style-type:none">
<div id="left_check">
<li>
<form>
<input id="united_states1" type="checkbox" name="location" value="united_states">United States (domestic)
<br>
<div id="padded-left">
<input id="west1" type="checkbox" class="location" value="west_coast">West
<br>
<input id="east1" type="checkbox" class="location" value="central_us">East
<br>
<input id="cent1" type="checkbox" class="location" value="east_coast">Central
</div>
</form>
</li>
</div>
<div id="right_check">
<li>
<form>
<input id="euro1" type="checkbox" class="location" value="europe">Europe
<br>
<input id="africa1" type="checkbox" class="location" value="africa">Africa
<br>
<input id="asia1" type="checkbox" class="location" value="asia">Asia
<br>
<input id="aust1" type="checkbox" class="location" value="australia">Australia
</form>
</li>
</div>
<div id="mid_check">
<div id="left_align">
<li>
<form>
<input id="canada1" type="checkbox" class="location" value="canada">Canada
<br>
<input id="centr_am1" type="checkbox" class="location" value="central_america">Central America
<br>
<input id="south_am1" type="checkbox" class="location" value="south_america">South America
<br>
<input id="ocean1" type="checkbox" class="location" value="oceanic">Oceanic
</form>
</li>
</div>
</div>
</ul>
</div>
Is this what you trying to get?

Related

How to move form to the middle of my webpage? [duplicate]

This question already has answers here:
How to center an element horizontally and vertically
(27 answers)
Closed 3 months ago.
Image of my Form
I'd like to move this form to the middle of my web page. I have it center aligned currently, but it is at the top of my webpage. I want it smack dab in the middle. I've been trying to google around but this has been a surprisingly difficult answer to find.
html
<body>
<div class="form">
<form action="./script.js" method="post">
<ul>
<li>
<label for="date">Date:</label>
<input type="date" id="date" name="date" step="0.1" min="0"
placeholder="What's the date today?" size="50">
</li>
<li>
<label for="mileage">Mileage:</label>
<input type="number" id="mileage" name="mileage" step="0.1" min="0"
placeholder="How many miles today?" size="50">
</li>
<li>
<label for="note">Notes:</label>
<textarea id="note" name="user_message" placeholder="How did the run feel?"></textarea>
</li>
<li class="button">
<button type="submit">Submit</button>
</li>
</ul>
</form>
</div>
</body>
</html>
CSS
div.form {
display: block;
text-align: center;
}
form {
margin: 0 auto;
width: 600px;
padding: 1em;
border: 1px solid lightgrey;
border-radius: 1em;
display: inline-block;
margin-left: auto;
margin-right: auto;
text-align: left;
}
form li+li {
margin-top: 1em;
}
This should work:
div.form {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
form {
margin: 0 auto;
width: 600px;
padding: 1em;
border: 1px solid lightgrey;
border-radius: 1em;
text-align: left;
}
form li+li {
margin-top: 1em;
}
<body>
<div class="form">
<form action="./script.js" method="post">
<ul>
<li>
<label for="date">Date:</label>
<input type="date" id="date" name="date" step="0.1" min="0"
placeholder="What's the date today?" size="50">
</li>
<li>
<label for="mileage">Mileage:</label>
<input type="number" id="mileage" name="mileage" step="0.1" min="0"
placeholder="How many miles today?" size="50">
</li>
<li>
<label for="note">Notes:</label>
<textarea id="note" name="user_message" placeholder="How did the run feel?"></textarea>
</li>
<li class="button">
<button type="submit">Submit</button>
</li>
</ul>
</form>
</div>
</body>
</html>
Super easy, give your container all the view height and then super center it with grid.
I forced your form to half of the view width just to show it was centered.
.form-container {
height: 100vh;
display: grid;
place-items: center;
}
/* this is just style */
form {
margin: 0 auto;
width: 50vw;
padding: 1em;
border: 1px solid lightgrey;
border-radius: 1em;
display: inline-block;
margin-left: auto;
margin-right: auto;
text-align: left;
}
form li+li {
margin-top: 1em;
}
<div class="form form-container">
<form action="./script.js" method="post">
<ul>
<li>
<label for="date">Date:</label>
<input type="date" id="date" name="date" step="0.1" min="0" placeholder="What's the date today?" size="50">
</li>
<li>
<label for="mileage">Mileage:</label>
<input type="number" id="mileage" name="mileage" step="0.1" min="0" placeholder="How many miles today?" size="50">
</li>
<li>
<label for="note">Notes:</label>
<textarea id="note" name="user_message" placeholder="How did the run feel?"></textarea>
</li>
<li class="button">
<button type="submit">Submit</button>
</li>
</ul>
</form>
</div>
form {
margin: 0 auto;
width: 600px;
padding: 1em;
border: 1px solid lightgrey;
border-radius: 1em;
text-align: left;
}
form li+li {
margin-top: 1em;
}
.form{
display:flex;
height:calc(100vh - 2px);
justify-content:center;
align-items:center;
border:solid 1px red;}
body,html,div{
margin:0;
padding:0;}
<body>
<div class="form">
<form action="./script.js" method="post">
<ul>
<li>
<label for="date">Date:</label>
<input type="date" id="date" name="date" step="0.1" min="0"
placeholder="What's the date today?" size="50">
</li>
<li>
<label for="mileage">Mileage:</label>
<input type="number" id="mileage" name="mileage" step="0.1" min="0"
placeholder="How many miles today?" size="50">
</li>
<li>
<label for="note">Notes:</label>
<textarea id="note" name="user_message" placeholder="How did the run feel?"></textarea>
</li>
<li class="button">
<button type="submit">Submit</button>
</li>
</ul>
</form>
</div>
</body>

Left align title with input boxes flexbox

I was wondering whether there is a better way (more dynamic) way of left aligning the title with the input boxes below it using flexbox. The input boxes need to be displayed inline with the title above them. Currently I've had to wrap a div around both the title and input boxes and set a fixed pixel width. Is there a better way of achieving the same result with flexbox?
I've tried using inline-flex on this wrapper but it's still treating it as a full width element instead of being as wide as its content. I've also tried setting inline-flex on the unordered list and the result is exactly the same.
I would like to not have to set a fixed pixel width. The next time if I need to do the same but with a different element, I would need to keep setting a fixed pixel size which isn't ideal.
Thanks in advance
html {
font-size: 14px;
}
.section {
padding: 1.5rem;
}
.wrapper {
display: flex;
background: lightblue;
}
.warning-percentage-wrapper {
background: lightcoral;
flex: 0 0 30%;
}
.warning-percentage {
display: inline-flex;
margin-left: -1rem;
}
.warning-percentage li {
flex: 0 1 80px;
margin-left: 1rem;
}
.days-of-week-wrapper {
background: lightseagreen;
flex: 1;
display: flex;
justify-content: flex-end;
}
.inline-wrapper {
background: pink;
display: flex;
flex-direction: column;
flex: 0 1 644px;
}
.days-of-week {
display: inline-flex;
margin-left: -1rem;
}
.days-of-week li {
flex: 0 1 80px;
margin-left: 1rem;
}
<section class="section">
<div class="wrapper">
<div class="warning-percentage-wrapper">
<h5 class="title is-5">Warning Percentages</h5>
<ul class="warning-percentage">
<li>
<label class="label">Low</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Medium</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">High</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
<div class="days-of-week-wrapper">
<div class="inline-wrapper">
<h5 class="title is-5">Days of Week</h5>
<ul class="days-of-week">
<li>
<label class="label">Monday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Tuesday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Wednesday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Thursday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Friday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Saturday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Sunday</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
</div>
</div>
</section>
if you want something as same as the pic you put in your question, you must remove padding/margin from your elements (such as input, label)
html {
font-size: 14px;
}
.wrapper {
display: flex;
background: lightblue;
}
.warning-percentage-wrapper {
background: lightcoral;
}
.warning-percentage {
display: inline-flex;
}
.warning-percentage li {
flex: 0 1 80px;
margin-left: 1rem;
}
.days-of-week-wrapper {
background: lightseagreen;
flex: 1;
display: flex;
justify-content: flex-end;
}
.inline-wrapper {
background: pink;
display: flex;
flex-direction: column;
}
.days-of-week {
display: inline-flex;
}
<section class="section">
<div class="wrapper">
<div class="warning-percentage-wrapper">
<h5 class="title is-5">Warning Percentages</h5>
<ul class="warning-percentage">
<li>
<label class="label">Low</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Medium</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">High</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
<div class="days-of-week-wrapper">
<div class="inline-wrapper">
<h5 class="title is-5">Days of Week</h5>
<ul class="days-of-week">
<li>
<label class="label">Monday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Tuesday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Wednesday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Thursday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Friday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Saturday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Sunday</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
</div>
</div>
</section>
<!-- end snippet -->
The problem I'm having with inline-flex is caused using a flex basis with a pixel value. I needed the inputs to all be the same width. I forgot to mention I am using Bulma (not by choice) which removes all the margins and padding's from elements by default.
My example below should hopefully provide a better understanding of the problem. Notice I've set the UL - 'days-of-week' to align-self. Now the UL is as wide a its content which is what I wanted. However if you hover over the element with your dev tools there's still quite a bit of space remaining. This is because I'm using a flex-basis with a pixel value. If you set to LI to flex: 1 and inspect the DOM, the elements are nicely fill the space, including the margins.
The solution for this is to remove the flex styles altogether on the LI elements and set a fixed pixel width on the 'inline-wrapper' element. I don't think this is ideal but it allows you to control the size of the LI's without needing additional css styling on the LI's themselves.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="bulma-0.8.0/css/bulma.min.css" rel="stylesheet" />
<style>
html {
font-size: 14px;
}
.section {
padding: 1.5rem;
}
.wrapper {
display: flex;
background: lightblue;
}
.warning-percentage-wrapper {
background: lightcoral;
flex: 0 0 30%;
}
.warning-percentage {
display: inline-flex;
margin-left: -1rem;
}
.warning-percentage li {
flex: 0 1 80px;
margin-left: 1rem;
}
.days-of-week-wrapper {
background: lightseagreen;
flex: 1;
display: flex;
justify-content: flex-end;
}
.inline-wrapper {
background: pink;
display: flex;
flex-direction: column;
flex: 0 1 644px;
}
.days-of-week {
display: inline-flex;
align-self: flex-start;
}
.days-of-week li {
flex: 0 1 80px;
margin-left: 1rem;
}
.days-of-week li:first-child {
margin-left: 0;
}
</style>
</head>
<body>
<section class="section">
<div class="wrapper">
<div class="warning-percentage-wrapper">
<h5 class="title is-5">Warning Percentages</h5>
<ul class="warning-percentage">
<li>
<label class="label">Low</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Medium</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">High</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
<div class="days-of-week-wrapper">
<div class="inline-wrapper">
<h5 class="title is-5">Days of Week</h5>
<ul class="days-of-week">
<li>
<label class="label">Monday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Tuesday</label>
<input class="input" type="text" readonly>
</li>
<li>
<label class="label">Wednesday</label>
<input class="input" type="text" readonly>
</li>
</ul>
</div>
</div>
</div>
</section>
</body>
</html>

How do I put a border around my form using CSS?

I'm trying to create a border around my checklist but I'm not sure how to write the CSS.. Currently the border is going around everything.. I've attached a screen shot to show you what I mean. The black border is what I'm getting and the red border I added in paint to show you what I'm trying to do.. Any help would be appreciated.
Image uploaded using imgbb.com
https://ibb.co/h6xTbK
My HTML for the left side "Subject list" and the center checklist
<div class="notes">
<h2 class="subject">Subject Notes</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Ruby</li>
<li>Ruby on Rails</li>
<li>jQuery</li>
</ul>
</div>
<div class="checklist">
<h2>To Do List</h2>
<!-- To do list with check box as a test -->
<form>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
</form>
</div>
My CSS for the left side "Subject notes" and the center checklist..
.notes ul {
position: absolute;
list-style-type: none;
margin: 0 0;
padding: 0;
overflow: hidden;
}
.notes {
position: absolute;
top: 160px;
}
.notes ul li {
margin: 10px;
}
.notes li a{
text-decoration: underline;
color: #493C3D;
}
.checklist {
position: relative;
text-align: center;
border-style: solid;
border-width: 5px;
}
Try this. You have done lots of mistake I have corrected it. Please check.
.notes ul {
position: absolute;
list-style-type: none;
margin: 0 0;
padding: 0;
overflow: hidden;
}
.notes {
/* position: absolute; */
/* top: 160px; */
float: left;
}
.wrap {
text-align: center;
}
.notes ul li {
margin: 10px;
}
.notes li a {
text-decoration: underline;
color: #493C3D;
}
.checklist {
position: relative;
text-align: center;
border-style: solid;
border-width: 5px;
display: inline-block;
}
<div class="wrap">
<div class="notes">
<h2 class="subject">Subject Notes</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Ruby</li>
<li>Ruby on Rails</li>
<li>jQuery</li>
</ul>
</div>
<div class="checklist">
<h2>To Do List</h2>
<!-- To do list with check box as a test -->
<form>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
<input type="checkbox" name="list" value="" />data
<br>
</form>
</div>
</div>
Is this what you want?
I wrapped the checklist with a div , made its position:inline-block and then added a red border.
.notes ul {
position: absolute;
list-style-type: none;
margin: 0 0;
padding: 0;
overflow: hidden;
}
.notes {
position: absolute;
top: 10px;
}
.notes ul li {
margin: 10px;
}
.notes li a {
text-decoration: underline;
color: #493C3D;
}
.checklist {
position: relative;
text-align: center;
border-style: solid;
border-width: 5px;
}
.parent{
display:inline-block;
border:2px solid red;
padding:5px 30px;
}
<div class="notes">
<h2 class="subject">Subject Notes</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Ruby</li>
<li>Ruby on Rails</li>
<li>jQuery</li>
</ul>
</div>
<div class="checklist">
<!-- To do list with check box as a test -->
<form>
<div class="parent">
<h2>To Do List</h2>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
<input type="checkbox" name="list" value="" />data<br>
</div>
</form>
</div>
I add width to checklist:
<div class="notes">
<h2 class="subject">Subject Notes</h2>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
<li>Ruby</li>
<li>Ruby on Rails</li>
<li>jQuery</li>
</ul>
</div>
<div class="checklist">
<h2>To Do List</h2>
<!-- To do list with check box as a test -->
<form>
<div class="checklist_wrapper">
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
<input type="checkbox" name="list" value="">data</input><br>
</div>
</form>
</div>
.notes ul {
position: absolute;
list-style-type: none;
margin: 0 0;
padding: 0;
overflow: hidden;
}
.notes {
position: absolute;
top: 50px;
}
.notes ul li {
margin: 10px;
}
.notes li a{
text-decoration: underline;
color: #493C3D;
}
.checklist {
position: relative;
text-align: center;
border-style: solid;
border-width: 5px;
margin:0 auto;
border:1px solid red;
width:40%;
}

My <section> is in the top of my <nav>, as far as I know <nav> is in top of <section>

SO my <section> appears in te top of the <nav>, let say it will text wrap the <nav> section. How will I put the <section> below the <nav>
It gives me problem every time i put some text in and the text will appear behind the nav
body {
background-color: white;
}
table {
border-collapse: collapse;
width: 100%;
}
td,
th {
padding: 8px;
text-align: left;
border-bottom: 1px solid #ddd;
}
header,
footer {
padding: 1em;
color: white;
background-color: grey;
clear: left;
text-align: center;
}
nav ul {
list-style-type: none;
padding: 0;
}
nav ul a {
text-decoration: none;
}
section {}
aside {
float: left;
}
aside.right {
float: right;
}
<header>
<img src="mf.png" alt="Mandaue Foam" align="left" style="width:180px;height:108.56px;">
<div style="text-align: right;">Search: <input type="text" name="Search" placeholder="Search Here"></br>
</br>
</br>
</br>
</div>
<div style="text-align: right;">AF No. : <input type="text" name="AF No." placeholder="AF No."></br>
</div>
<div style="text-align: right;">Asset No. : <input type="text" name="AF No." placeholder="Asset No."></div>
<div style="text-align: center; text"><strong> ACCOUNTABILITY FORM <strong></div>
</br>
</header>
<nav>
<div style='position:fixed;top:230px;left:100px;'><input type="radio" name="progress" id="progress1" value="1" tabIndex="1" onClick="ckChange(this)"> For Official Use </br></br>
<input type="radio" name="progress" id="progress2" value="1" tabIndex="1" onClick="ckChange(this)"> For use in showroom to be returned on <input type ="date"></br></br>
<input type="radio" name="progress" id="progress3" value="1" tabIndex="1" onClick="ckChange(this)"> For use in showroom not to be returned
<div style='position:fixed;top:230px;right:150px;'><input type="radio" name="progress" id="progress4" value="1" tabIndex="1" onClick="ckChange(this)"> For sample</br></br><div>
<input type="radio" name="progress" id="progress5" value="1" tabIndex="1" onClick="ckChange(this)"> On Loan </br></br>
<input type="radio" name="progress" id="progress6" value="1" tabIndex="1" onClick="ckChange(this)"> Other <input type="text" name="progress" id="progress6" placeholder="State the Purpose">
</nav>
<section>
</section>
Your html code is invalid. please check again, and that's what causes your above .
please look at jsfiddle for the full code.
https://jsfiddle.net/vLbmc6z9/
<header>
<div>
<img src="mf.png" alt="Mandaue Foam" align="left">
</div>
</header>

center form on the page

I am trying to get my form to center on desktop. It's currently to the left side.
I tried doing display: block and margin-left: auto and margin-right: auto and it is still being fussy.
The picture below shows the issue and I'll add a snippet and a fiddle to help. Thanks in advance.
Jsfiddle: https://jsfiddle.net/r87h2L6n/
/*********FORMS CSS*************/
form {
display: block;
margin-left: auto;
margin-right: auto;
}
form.contact label {
display: block;
}
span {
display: block;
border: none;
color: white;
}
.clearfix:after {
content: " ";
display: block;
clear: both;
}
fieldset {
width: 45%;
float: left;
border: none;
}
input.checks {
width: auto;
}
.left {
width: 45%;
float: left;
}
.right {
width: 45%;
float: right;
}
input {
border: none;
border-bottom: 2px solid #959595;
width: 300px;
margin: 3px;
color: #6C6A6A;
padding-top: 10px;
padding-bottom: 10px;
}
.bottom {
border: none;
margin: 3px;
color: #6C6A6A;
padding-top: 10px;
padding-bottom: 10px;
width: 300px;
}
.fa {
margin-right: 10px;
}
legend {
color: white;
}
.button {
display: inline-block;
padding: 15px 25px;
font-size: 14px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #595959;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
width: 150px;
}
.button:hover {
background-color: #670809
}
.button:active {
background-color: #670809;
box-shadow: 0 5px #666;
transform: translateY(4px);
}
<section class="clearfix" id="fourthpara">
<div class="imgbox5">
<img id="pic5" class="adjustable float move" src="http://weknowyourdreams.com/images/kitten/kitten-08.jpg" alt="example web page">
</div>
<h2>Student Review 3</h2>
<p class="side">
“This class is up to date on the latest techniques, the instructor is willing to go the extra mile, and the class is well structured” -Papa Smurf
</p>
</section>
</div>
</section>
<div class="center clearfix">
<h1 id="fourth">Contact</h1>
<form action="FormToEmail.php" method="POST" enctype="multipart/form-data" autocomplete="on" class="contact clearfix ">
<section class="clearfix">
<fieldset>
<legend>
<i class="fa fa-user" aria-hidden="true"></i>Personal Information
<hr class="style2">
</legend>
<label><span></span>
<input name="first_name" type="text" value="" placeholder="First Name" required/>
</label>
<label><span>
</span>
<input name="last_name" type="text" value="" placeholder="Last Name" required/>
</label>
<label><span> </span>
<input name="date_of_birth" type="date" value="" placeholder="Date of Birth" required/>
</label>
<label><span>
</span>
<input type="number" name="quantity" min="1" max="6" placeholder="number of years until next degree">
</label>
<label><span></span>
<input name="level_of_education" type="hidden" value="" placeholder="level of education" required/>
</label>
<select class="bottom" name="education_level">
<option value="High School">High School</option>
<option value="Undergraduate">Undergradute</option>
<option value="Graduate">Graduate</option>
</select>
</fieldset>
<fieldset>
<legend><i class="fa fa-envelope-o" aria-hidden="true"></i>
Contact Information
<hr class="style2">
</legend>
<label><span>
</span>
<input class="ghost-input" name="email" value="" type="email" placeholder="youremail#email.com" autocomplete="off" />
</label>
<label><span></span>
<input name="phonenumber" value="" type="tel" placeholder="763-858-9564" />
</label>
<label><span></span>
<input name="website" value="" type="url" placeholder="https://yourwebsite.com" />
</label>
</fieldset>
</section>
<section class="clearfix column">
<fieldset>
<legend><i class="fa fa-laptop" aria-hidden="true"></i>
What are your Interests
<hr class="style2">
</legend>
<section class="clearfix column left">
<label class="bottom span"><span><input name="webdesign" value="web_design" type="checkbox" class="checks"/>Web Design</span>
</label>
<label class="bottom"><span><input name="webdevelopment" value="web_development" type="checkbox" class="checks" />Web Development</span>
</label>
<label class="bottom"><span><input name="computerscience" value="computer_science" type="checkbox"class="checks" />Computer Science</span>
</label>
</section>
<section class="clearfix column left">
<label class="bottom"><span><input name="graphicdesign" value="graphic_design" type="checkbox" class="checks"/>Graphic Design</span>
</label>
<label class="bottom"><span><input name="userexperience" value="user_experience" type="checkbox" class="checks" />User Experience</span>
</label>
<label class="bottom"><span><input class="checks" name="appdevelopment" value="app_development" type="checkbox" />App Development</span>
</label>
</section>
</fieldset>
<fieldset>
<legend><i class="fa fa-volume-control-phone" aria-hidden="true">
</i>
Follow Up
<hr class="style2 toosmall">
</legend>
<section class="clearfix column left">
<legend class="smaller">You can contact me by:</legend>
<br>
<div class="squish">
<label class="bottom"><span><input class="checks" name="contact_me" type="radio" value="phone" checked/>Contact me by phone</span>
</label>
<label class="bottom"><span><input class="checks" name="contact_me" type="radio" value="email" checked/>Contact me by email</span>
</label>
<label class="bottom"><span><input class="checks" name="contact_me" type="radio" value="text"/>Contact me by text</span>
</label>
<br>
</div>
</section>
<section class="clearfix column left">
<legend class="smaller">I'm interested in:</legend>
<br>
<label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Undergraduate</span>
</label>
<label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Graduate</span>
</label>
<label class="bottom"><span><input class="checks" name="interest" type="radio" value="text"/>Online</span>
</label>
</section>
</fieldset>
</section>
<input class="button" name="submit_to_programmer" type="submit" value="Submit" />
<input type="hidden" value="Message from Car Website" name="subject">
<input name="redirect" type="hidden" value="thanks.html">
</form>
To add to Michael_B`s answer your form is set to take up the full width of the page as its a block element by default and you have set it as well. Margin auto only works for elements that are block or inline-block elements and they width of either must be set to a specified value for it to work.
To address your problem now, looking at your source code, you can get the result you expect by removing the float set on your fieldset element in your CSS and setting Margin to auto in that element. I am not sure what the purpose of the float in that CSS rule but you cannot center something that you have set to float. Hope this helps
The reason it's not centering is that your form element is a block level container and, therefore, it's occupying 100% width of the page. As a result, there no space left for centering.
As you wrote:
I tried doing display: block and margin-left: auto and margin-right: auto and it is still being fussy.
Well, if you give an element display: block it consumes all available horizontal space. Hence, margin-left: auto and margin-right: auto have no effect.
Try defining a width for the form (e.g. width: 30em), removing float rules and/or giving the form text-align: center, which centers the child elements.
It's not your form that is the issue here, it is your fieldset...again. Give this a whirl.
fieldset {
width: 45%;
margin: 0 auto;
/* float: left; -- DELETE float: left if you want this centered */
border: none;
}
UPDATE:
If you also want that submit button to be centered, here is the css for that.
.button {
margin: 0 auto; /* ADDED THIS */
display: block; /* Took inline-block out, just use block */
padding: 15px 25px;
font-size: 14px;
cursor: pointer;
text-align: center;
text-decoration: none;
outline: none;
color: #fff;
background-color: #595959;
border: none;
border-radius: 15px;
box-shadow: 0 9px #999;
width: 150px;
}
LIVE DEMO