By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,639 Members | 1,988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,639 IT Pros & Developers. It's quick & easy.

Vertical white space in between images where I don't want it

P: n/a
Hello, basically, I'm just learning intermediate CSS and trying to convert
my old table webpage completely to CSS. Hoorah, right? Well, it's not quite
going as planned. It's an extremely simple layout, and I'm finding myself
stuck with small white space in between my images where I planned for the
graphics to be stacked up right on top of one another.

Here's the simple vertical layout: width is 640px, centered with a CSS
border. I'd basically like absolutely no space in between all these
elements.

[logo image (about 300px), centered]
[navbar top image, centered, 7px high] - a horizontal navbar
[navbar link images, 3 of 'em with 2 separator images between, all centered,
45px high]
[navbar bottom bar image, centered, 7px high, identical to top image]
[content, right under that with no space]
[footer]

My main problem is that there's a few seemingly random px worth of white
space in between my navbar lines, each in their own <div>. Even when I
specify a margin: 0; padding: 0; for my images or the <div>, there's still
that space and they are not stacking vertically without the space.

What is a simple way to stack these images on top of one another without
absolute positioning? I'm just learning about absolute and relative
positioning btw.

Thanks


Jul 20 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Applebrown wrote in
<YRQuc.636673$Ig.371568@pd7tw2no>
Hello, basically, I'm just learning intermediate CSS and trying to
convert my old table webpage completely to CSS. Hoorah, right? Well,
it's not quite going as planned. It's an extremely simple layout, and
I'm finding myself stuck with small white space in between my images
where I planned for the graphics to be stacked up right on top of one
another.

Here's the simple vertical layout: width is 640px, centered with a CSS
border. I'd basically like absolutely no space in between all these
elements.

[logo image (about 300px), centered]
[navbar top image, centered, 7px high] - a horizontal navbar
[navbar link images, 3 of 'em with 2 separator images between, all
centered, 45px high]
[navbar bottom bar image, centered, 7px high, identical to top image]
[content, right under that with no space]
[footer]

My main problem is that there's a few seemingly random px worth of
white space in between my navbar lines, each in their own <div>. Even
when I specify a margin: 0; padding: 0; for my images or the <div>,
there's still that space and they are not stacking vertically without
the space.

What is a simple way to stack these images on top of one another
without absolute positioning? I'm just learning about absolute and
relative positioning btw.

It's easier with a URL but have you tried removing any line breaks between
images? The break is interpreted as a space by the browser.

<img...><img...> - no white space

<img...>
<img...> - produces a line of white space between the images.
--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.

Jul 20 '05 #2

P: n/a
Thanks for the response.

I found out later by searching a CSS forum that IE has a default line-height
of 16px. Therefore, each of my 7px high navbars had 9px extra of white
space. When I added:

line-height: 1px;
font-size: 1px;

to the navbar rules, they all matched up perfectly. That's something that I
probably wouldn't have guessed easily...
"PeterMcC" <pe***@mccourt.org.uk> wrote in message
news:40bc4000$0$27217$ed2619ec@ptn-nntp-

It's easier with a URL but have you tried removing any line breaks between
images? The break is interpreted as a space by the browser.

<img...><img...> - no white space

<img...>
<img...> - produces a line of white space between the images.
--
PeterMcC
If you feel that any of the above is incorrect,
inappropriate or offensive in any way,
please ignore it and accept my apologies.

Jul 20 '05 #3

P: n/a
"Applebrown" <ap********@gamebanshee.takethis.andthisout.com> wrote:
Thanks for the response.
Not top posting would be the best way to thank the regulars. ;-)
I found out later by searching a CSS forum that IE has a default line-height
of 16px.


No it doesn't. IE has a factory default font-size of 16px, the
line-height will be somewhat larger than that (about 18 or 19px).

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #4

P: n/a

"Steve Pugh" <st***@pugh.net> wrote in message
news:4d********************************@4ax.com...
"Applebrown" <ap********@gamebanshee.takethis.andthisout.com> wrote:
Thanks for the response.
Not top posting would be the best way to thank the regulars. ;-)


Deal.
I found out later by searching a CSS forum that IE has a default line-heightof 16px.


No it doesn't. IE has a factory default font-size of 16px, the
line-height will be somewhat larger than that (about 18 or 19px).
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>

Jul 20 '05 #5

P: n/a
"Applebrown" <ap********@gamebanshee.takethis.andthisout.com> wrote:
Not top posting would be the best way to thank the regulars. ;-)


Deal.


Trimming quotes is an essential part of bottom posting.

--
Spartanicus
Jul 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.