I have simplified the code as much as possible, but still can't get it to center. I believe my inexperience with CSS
is not allowing me to see something extremely simple.
If anyone also knows some good resources for css, that'll be great. I have read sections of many CSS
books but there all very basic and cover the same thing.
CSS Markup:
/* MAIN ––––––––––––––––––––– */
html {
/* overflow-y:scroll; */
}
body {
/* margin:0; */
/* position:relative; */
}
/* Form ––––––––––––––––––––– */
#form {
margin:0 auto;
width: 300px;
height: 200px;
display: inline-block;
border: 2px solid black;
}
index.html
<html>
<body>
<form id='form'></form>
</body>
</hml>
Change the display to block if you want to use margin:auto for centering. That does not work with inline elements.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With