Jump to content
  • Advertisement
Sign in to follow this  
Greg K

[web] CSS Positioning

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to use top:0px; bottom:1px; left:0px; right:1px; to size my div. This works great in firefox, but dies in IE. How do I do this? -Greg

Share this post


Link to post
Share on other sites
Advertisement
In IE when you try to set the width/left/right using a combination of left and right it assumes left:0; width:100%; A workaround is to set it to left:0; width:100%; margin-left: something; margin-right: something;

Share this post


Link to post
Share on other sites


<html>
<head>
</head>
<body>

<style>

div.outerBox
{
position:relative;
top:0px;
left:0px;
height:100%;
width:100%;
border-style:solid;
border-width:1px;
margin:0px;
}

div.innerBox
{
position:absolute;
top:0px;
left:0px;
bottom:1px;
right:1px;
border-style:solid;
border-width:1px;
margin:0px;
}
</style>

<div style="width:20em; height:20em;">
<div class="outerBox">
<div class="innerBox"></div>
</div>
</div>

</body>
</html>





This shows what I mean. The inner box is NOT 1px away from the bottom right... (in internet explorer)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!