My website was almost 100% done when I checked it to the W3C Validator. Got an error saying that I didn't declare a Doctype. So I added the HTML 5 <!DOCTYPE html>
. OK, the error is gone. But why does the layout becomes so messed up like?
Please view it below.
http://itsdaffa.16mb.com/ --> Without Doctype
http://itsdaffa.16mb.com/error.html --> WITH Doctype
I have stumbled upon some answers about similar issues but couldn't really understand since mostly are their code's specific error. In this question for example, the user solved his problem by removing negative right
property values while I don't have any in my code.
I am a complete beginner to this, in fact this is the first website I'm building from scratch. I desperately need help. Thanks :)
You will need to put this in your CSS:
html, body {
height: 100%
}
The reason being when you add the doctype, then you are switching from quirks mode to standards mode. In standards mode the html and body elements do not default to 100% height.
See explanation here
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