Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-12-2005, 08:03 PM   PM User | #1
cathode
New Coder

 
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
cathode is an unknown quantity at this point
Help with spacing between vertically stacked images in mozilla

Hello,
I am having a problem with a space above and below vertically stacked images in Mozilla:

Code:
<div class="centerer"><img src="images/image.jpg" /><img src="images/image.jpg" /><table border="0" cellspacing="0" cellpadding="0">
... (table content ) ...
</table>
</div>
I have also tried it like this, with the addition of BR's:
Code:
<div class="centerer"><img src="images/image.jpg" /><br /><img src="images/image.jpg" /><br /><table border="0" cellspacing="0" cellpadding="0">
... (table content ) ...
</table>
</div>
Note that I have no line breaks in between the tags. It looks fine in IE 6 but not mozilla... there's no padding or anything set for images.

Any ideas?
Thanks
cathode is offline   Reply With Quote
Old 08-12-2005, 08:20 PM   PM User | #2
Tristan Gray
Regular Coder

 
Join Date: Jul 2005
Location: Halifax, Nova Scotia, Canada
Posts: 392
Thanks: 1
Thanked 0 Times in 0 Posts
Tristan Gray is an unknown quantity at this point
You need to set the padding to 0px otherwise the browsers will add default padding. So you MUST define no padding if that is what you wish.
__________________
Once I thought I was wrong but I was mistaken.
Tristan Gray is offline   Reply With Quote
Old 08-12-2005, 08:24 PM   PM User | #3
cathode
New Coder

 
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
cathode is an unknown quantity at this point
Hey,
Thanks for the response:

I tried this in the css:

img {
padding: 0 0 0 0;
}

But that didn't help. Do I need to wrap the images in a zero padding span or div just to get that?
cathode is offline   Reply With Quote
Old 08-12-2005, 08:33 PM   PM User | #4
Tristan Gray
Regular Coder

 
Join Date: Jul 2005
Location: Halifax, Nova Scotia, Canada
Posts: 392
Thanks: 1
Thanked 0 Times in 0 Posts
Tristan Gray is an unknown quantity at this point
Try adding:

HTML { padding: 0px; margin: 0px; }

Body { padding: 0px; margin: 0px; }

img { padding: 0px; margin: 0px; }


In my opinion you should always put the units even after a null value. Also, no need to define each padding separately if they are all to be set to zero just use padding: 0px; same goes for margin. I'm done here at work so good luck, I'm off like a prom dress to drink Absinthe and coward from this foul year of our Lord.
__________________
Once I thought I was wrong but I was mistaken.
Tristan Gray is offline   Reply With Quote
Old 08-12-2005, 08:34 PM   PM User | #5
Tristan Gray
Regular Coder

 
Join Date: Jul 2005
Location: Halifax, Nova Scotia, Canada
Posts: 392
Thanks: 1
Thanked 0 Times in 0 Posts
Tristan Gray is an unknown quantity at this point
Oh, and if that doesn't help it may be mozilla leaving space for a scrollbar.
__________________
Once I thought I was wrong but I was mistaken.
Tristan Gray is offline   Reply With Quote
Old 08-12-2005, 09:50 PM   PM User | #6
cathode
New Coder

 
Join Date: Jun 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
cathode is an unknown quantity at this point
Thanks for your help!

Even though I wish that I didn't have to complexify things, I ended up using yet another div that set the line-spacing to 0.
cathode is offline   Reply With Quote
Old 08-13-2005, 12:06 AM   PM User | #7
rmedek
Senior Coder

 
Join Date: Nov 2003
Location: Minneapolis, MN
Posts: 2,879
Thanks: 2
Thanked 65 Times in 56 Posts
rmedek is on a distinguished road
Imaes are displayed inline by default (no line breaks). If you want to stack some vertically without using <br>s, you would do something like this:
Code:
HTML:

<img src="example.gif" width="100" height="100" alt="a photo of something" />
<img src="example.gif" width="100" height="100" alt="a photo of something" />
<img src="example.gif" width="100" height="100" alt="a photo of something" />
<img src="example.gif" width="100" height="100" alt="a photo of something" />

CSS:

img {
 display: block;
 padding: 0;
 margin: 0;
 }
Line-height, spacing, etc. affects inline elements, so once you set the display to block you shouldn't need that anymore. Also, make sure you're using a correct DOCTYPE or IE and Mozilla are going to have plenty of other inconsistencies.

Hope this helps...
__________________
drums | web
rmedek is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:45 AM.


Advertisement
Log in to turn off these ads.