Dave's Brain

Browse - Programming Tips - Why doesn't a CSS absolute position work when my page has a DOCTYPE?

Date: 2008aug6
Platform: web
Lanuguage: html

Q.  Why doesn't a CSS absolute position work when my page has a DOCTYPE?

A.  The DOCTYPE makes it more strict.  You probably just need to add "px"
on your coordinates.

For example...

Does NOT work with DOCTYPE:

<div style="position:absolute; left:10; top:10;">Hello</div>
Does work with DOCTYPE:
<div style="position:absolute; left:10px; top:10px;">Hello</div>

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.