PDA

View Full Version : div position absolute with xhtml1-strict.dtd doctype



emanuelle
05-14-2008, 10:43 AM
I have this doctype(cannot change it):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I have this script:
<script>
function showd(element) {
var el = document.getElementById(element);
el.style.display = "block";
}

function closeContentD(element) {
var el = document.getElementById(element);
el.style.display = "none";
}
</script>

this css for the DIV that has to appear when I click on link:
.div_funnel{position:relative;
visibility:visible;
width:340px;
height:320px;
top:70;left:200;
z-index:100;
}

when I call for the DIV <a href="#" onclick="showd('funnelDIV')">LINK</a>)
the position ofthe div is not according to its css (top:70;left:200;)

this is due to doctype.
How can I fix it without changing the doctype?

jscheuer1
05-14-2008, 02:08 PM
You shouldn't be using XHTML, but that has nothing to do with this problem. Any valid URL DOCTYPE would cause this, including the recommended valid URL DOCTYPE (HTML 4.01 strict). The problem arises, at least in part, because with a valid URL DTD of this sort, units must be specified for both locations and dimensions. So add them:


.div_funnel {
position:relative;
visibility:visible;
width:340px;
height:320px;
top:70px;
left:200px;
z-index:100;
}