have been using no DOCTYPE but rather simply starting with <html> as per HTML5 standards (as I understood them). everything going ok.
began using Jade, which insists on DOCTYPE. using <!DOCTYPE html> – pages no longer render correctly(?).
as an easy and trivial example (behavior is same on firefox and chrome):
<html>
<body >
<div style='height:50%; background-color:pink;'></div>
<div style='height:50%; background-color:blue;'></div>
</body>
</html>
render just fine – have page pink, half blue
<!DOCTYPE html>
<html>
<body >
<div style='height:50%; background-color:pink;'></div>
<div style='height:50%; background-color:blue;'></div>
</body>
</html>
renders two skinny DIV’s you can’t see.
- what’s going on?
- thought
DOCTYPEwas being deprecated for HTML5 - what should I be doing?
Whoever who told you that
DOCTYPEis deprecated is either playing a prank on you or is plain ignorant.W3C on its article HTML5 differences from HTML4 on the section
Syntax, sub section 2.2 clearly states this.And as to, why the behavior when you set
<!DOCTYPE html>in your example.This behavior is expected. This is because
bodyis a block level element. So it has height, by default, in ashrink-to-fitmodel and width, by default, in anexpand-to-fitmodel. Settingstyle="height:100%;"in thebodytag allows body to take up the whole of the height available and displays your two divs.