My page (which uses HTML5) works fine with no doctype but when I add the HTML5 doctype then the styles on the <div>s don’t seem to work (specifically, one <div> which is supposed to be aligned 20 pixels from the left isn’t aligning… another <div> which is supposed to have a height of 90% reverts to the default height… and another <div> which I’ve changed the line spacing and character spacing seems to use the default line spacing and character spacing). Styles on the <span>s work just fine though… it only seems to be the <div>s that have the problem. I’ve changed <div> to <section>… still doesn’t work. I’ve tried inline styles, then switched to a style sheet… neither way seems to work. I threw in some display:block; (not sure what that does) but it didn’t seem to do anything.
And by the way, nothing’s wrong with the code. I ran it through a validator and it’s got no errors at all.
My page (which uses HTML5) works fine with no doctype but when I add
Share
You have an error in your CSS
Should be:
Note that you must specify a unit value for the value of
20– otherwise it may be ignored (which is what is causing your problem!)