Sunday, October 29, 2006

Firefox DIV Layer Issues

Working on a project recently, I ran across what appears to be a DIV layering issue while testing a web application in Firefox (specifically version 1.5.0.7). The project required using a DIV as a kind of menu bar and in this particular case I had to use absolute positioning to position it. What I observed was that when the “menu bar” DIV was visible, that it was not possible to click anything on the page “below” the DIV.

I searched the internet and found people with the same issues, but found no solutions other than “avoid absolute positioning”… I tried a few things, but ultimately stumbled upon on the solution. Check out the examples below:

This is an example of the issue.

<html>
<head>
<style type="text/css" media="all">
.absdiv
{
position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px;
}
</style>
</head>
<body>
line 1
<br>line 2
<br>line 3
<div class="absdiv">
<table>
<tr><td>test</td></tr>
</table>
</div>
</body>
</html>

Oddly enough, this sample did not have the DIV layering issue. Meaning, that it only happens when you have a table inside of the DIV. Very Interesting.

<html>
<head>
<style type="text/css" media="all">
.absdiv
{
position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px;
}
</style>
</head>
<body>
line 1
<br>line 2
<br>line 3
<div class="absdiv">test</div>
</body>
</html>

The solution to the issue was as simple as specifying a height for the DIV!

<html>
<head>
<style type="text/css" media="all">
.absdiv
{
position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; height: 12 ;
}
</style>
</head>
<body>
line 1
<br>line 2
<br>line 3
<div class="absdiv">
<table>
<tr><td>test</td></tr>
</table>
</div>
</body>
</html>

This is certainly something to remember the next time you’re working with layering DIV’s.

~ Bobby

5 comments:

  1. Anonymous5:43 AM

    школьница видеоонлайн http://free-3x.com/ порно онлайн пожилые с молодыми free-3x.com/ малолеток онлайн [url=http://free-3x.com/]free-3x.com[/url]

    ReplyDelete
  2. Anonymous12:12 PM

    Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

    ReplyDelete
  3. Anonymous3:24 PM

    You have to express more your opinion to attract more readers, because just a video or plain text without any personal approach is not that valuable. But it is just form my point of view

    ReplyDelete
  4. Anonymous9:03 AM

    I am reading this article second time today, you have to be more careful with content leakers. If I will fount it again I will send you a link

    ReplyDelete