By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,009 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

CSS positioning in Firefox & IE

P: 3
I am missing something about css positioning if Firefox is always right. I have simplifed some code that I've tested in both browers. Firefox responds to the left position code but not the top. IE responds to both. Would someone point out where I have gone wrong?

The Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Home</title>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Business">
<meta http-equiv="keywords" content="business planning">
<style type="text/css">
<!--
-->
</style>
</head>

<body>
<div style="position: relative; top: 50%; bottom: 0; left: 10%; right: 0; border: 2px green solid;">
<p>Now is the time for all good men to come to the aid of their party</p>
<p>The quick red fox jumped right over the lazy brown dog.</p>
</div>


</body>

</html>
Sep 30 '06 #1
Share this Question
Share on Google+
3 Replies


drhowarddrfine
Expert 5K+
P: 7,435
Because 50% is 50% of what? There is no dimension given. IE guesses correctly but, to guess at this, is the wrong thing to do. Include this with your css:
html,body{height:100%}
Oct 2 '06 #2

P: 20
Because 50% is 50% of what? There is no dimension given. IE guesses correctly but, to guess at this, is the wrong thing to do. Include this with your css:
html,body{height:100%}
...which is 100% of what? Same question! Firefox & IE must both be guessing what the 100% relates to.
Oct 3 '06 #3

drhowarddrfine
Expert 5K+
P: 7,435
The answer is in the css I gave you. <html> is the top level. <body> is the next one down, so <body> will be 100% of html which is 100% of the viewport and so on down the line. It's in the standard.
Oct 4 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.