User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 402,053 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,441 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 725 | Replies: 4 | Solved
Reply
Join Date: Feb 2008
Location: Seattle
Posts: 713
Reputation: jephthah is a jewel in the rough jephthah is a jewel in the rough jephthah is a jewel in the rough 
Rep Power: 4
Solved Threads: 45
jephthah's Avatar
jephthah jephthah is offline Offline
Master Poster

someone please explain why IE adds whitespace between images, Firefox does not

  #1  
Jun 15th, 2008
Disclaimer: I am not a webdesigner by any means, i only know enough to get my self into trouble.

Im trying to help a non-profit fix their webpage, and Im having a rotten time getting IE and Firefox to agree. the front page is a 3x3 grid of pictures that link to other pages. (some of the pictures are 2x wide).. it works just fine in FF -- all pictures are flush against each other. But IE keeps adding whitespace between the pictures within each row.

ive been hacking and poking at this a while, but nothing i do seems to make it better.

please help, thanks!



  1. <!-- // FROM HTML FILE // -->
  2.  
  3. <div id="main_imagemap">
  4. <div class="img">
  5. <a href="involved.htm"><img src = "images/nw.jpg" align="left"></a>
  6. <a href="video.htm"><img src = "images/nn.jpg"></a><br>
  7. <a href="outlook.htm"><img src = "images/ww.jpg" align="left"></a>
  8. <a href="about.htm"><img src = "images/ce.jpg"></a><br>
  9. <a href="projects.htm"><img src = "images/sw.jpg" align="left"></a>
  10. <a href="aboutus.htm"><img src = "images/ss.jpg" align="left"></a>
  11. <a href="news.htm"><img src = "images/se.jpg"></a><br>
  12. </div>
  13. </div>
  14.  
  15.  
  16. <!-- // FROM CSS FILE // -->
  17.  
  18. #main_imagemap
  19. {
  20. position:absolute;
  21. top:130pt;left:50pt;width:790;
  22. z-index:6;
  23. }
  24.  
  25. div.img img
  26. {
  27. display: inline;
  28. margin: 0px;
  29. padding: 0px;
  30. border: 2px solid #000000;
  31. }
  32. div.img a:hover img
  33. {
  34. border: 2px solid #F7EF6A;
  35. }
Why so serious?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Location: Arkansas
Posts: 367
Reputation: buddylee17 will become famous soon enough buddylee17 will become famous soon enough 
Rep Power: 2
Solved Threads: 70
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Whiz

Re: someone please explain why IE adds whitespace between images, Firefox does not

  #2  
Jun 15th, 2008
The reason is that each browser applies its own default stylesheet to your page. What this means is that each browser adds a certain amount of margin, padding, line height... to each element. The problem with this is that IE may add 2px and FireFox may add a different amount. Thus the inconsistency problem that has plagued the world of web design. The only way to make things appear consistent is to reset the elements you will be using in the beginning of your stylesheet. I often post this link, as the question comes up quite often. Have a read, it should clear some things up. Here is a link dealing with white space that IE adds in between images.
Last edited by buddylee17 : Jun 15th, 2008 at 6:10 pm.
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 713
Reputation: jephthah is a jewel in the rough jephthah is a jewel in the rough jephthah is a jewel in the rough 
Rep Power: 4
Solved Threads: 45
jephthah's Avatar
jephthah jephthah is offline Offline
Master Poster

Re: someone please explain why IE adds whitespace between images, Firefox does not

  #3  
Jun 15th, 2008
good articles, thanks. added to bookmarks

i actually found a workaround:

margin: 0px;
*margin: 0 0 0 -2;

'*' causes it to be ignored by FF, but still parsed by IE

not pretty, but hey, it works for now
Why so serious?
Reply With Quote  
Join Date: Jan 2007
Posts: 2,537
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 109
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: someone please explain why IE adds whitespace between images, Firefox does not

  #4  
Jun 19th, 2008
The real reason is that you can't have cross-browser compatibility if you place nonzero surrounding styles (margin,. border, padding) in the same tag that has size styles (width, height).

IE crams the surrounding styles INSIDE the size styles.

Other browsers put surrounding styles OUTSIDE the size styles, as the W3C standard states.

Positioning with respect to the browser window is not cross-browser compatible.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Feb 2008
Location: Seattle
Posts: 713
Reputation: jephthah is a jewel in the rough jephthah is a jewel in the rough jephthah is a jewel in the rough 
Rep Power: 4
Solved Threads: 45
jephthah's Avatar
jephthah jephthah is offline Offline
Master Poster

Re: someone please explain why IE adds whitespace between images, Firefox does not

  #5  
Jun 19th, 2008
Reason #143 Why We Hate Microsoft.
Why so serious?
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb HTML and CSS Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 11:55 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC