Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / October 2005



Tip: Looking for answers? Try searching our database.

Firefox en Opera: 1 pixel gap between 2 div blocks with width set to 50%

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Veerle - 28 Oct 2005 14:10 GMT
Hi,

I have 2 div blocks with each div taking up half of the page width. So
in the CSS they both have width: 50%. See
http://home.scarlet.be/~vv991306/leftright.html

In Mozilla Firefox and Opera, depending on the width of the browser
window, sometimes there is a 1 pixel gap between the 2 div blocks. In
Internet Explorer, this is never the case.

I think I know why the gap is sometimes there: Firefox and Opera
probably calculate the width of 1 div block as page width divided by 2.
If the page width is an even number, then the sum of the 2 widths
equals to the page width. But if the page width is an odd number then
the sum of the 2 widths + 1px = page width. This probably is the reason
for the 1 pixel gap.

The question is: anyone knows of a way to avoid this problem? I find
setting both one of the div widths to 51% not a nice solution, because
I want my two blocks to have equal widths and 51% makes quite a big
difference.

Any ideas?

Veerle
Els - 28 Oct 2005 14:48 GMT
> Hi,
>
[quoted text clipped - 19 lines]
>
> Any ideas?

You'll have to play with it a little, but I've noticed that it makes a
difference to set the width to auto and define the margin in
percentage, or vice versa. Maybe setting each div to auto and the
respective right or left margin to 50% does the trick. (maybe not)

Signature

Els                     http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
                            - Renato Russo -

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.