Gap under images

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
Mindwreck
Forum Newbie
Posts: 12
Joined: Mon Dec 02, 2002 10:10 am
Location: Illinois, USA
Contact:

Gap under images

Post by Mindwreck »

I'm getting a roughly 1-2px tall gap underneath images that I place on pages, I've always had this problem and it bugs the hell out of me. Does anybody know any HTML or CSS tricks to get rid of this?
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

do you have an example that we can look at? it helps to know what you have already done.
onestop
Forum Newbie
Posts: 5
Joined: Mon Dec 16, 2002 4:45 am

Post by onestop »

Hi
You could try
<img src="MY PIC" alt="" hspace="0" vspace="0" border="0">

settting the border to 0 removes the 1px border - if you don't specify border=0 the border is still there but you can't see it

hspace=0 and vspace=0 removes any padding from the image.

All browsers handle borders hspace and vspace differently if you don't specify values.

Hope that makes sense :)

Andy
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

why must people spout inefficient markup? i suggest using CSS to do the same thing:

Code: Select all

img &#123;
    padding: 0px;
    margin: 0px;
    border: 0px;
&#125;
onestop
Forum Newbie
Posts: 5
Joined: Mon Dec 16, 2002 4:45 am

Post by onestop »

Hi
I am new to this board and I answered a question with what is valid html - the question asked if there was an HTML or css answer. I gave an html answer - I see nothing wrong in that - I apologise in advance if I misread the tone used
why must people spout inefficient markup?
I may be new to this board but I am not new to web development.

Thank You

Andy
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

pardon my momentary frustrations. they come quick and often. for the past year i have become very adamnet about using CSS for all page formating so i tend to become a bit edgy on these topics. i do apologize for my tone. it was uncalled for.
Jay
Forum Newbie
Posts: 22
Joined: Fri Jul 12, 2002 8:36 am
Location: KUL, Malaysia

Re: Gap under images

Post by Jay »

Mindwreck wrote:I'm getting a roughly 1-2px tall gap underneath images that I place on pages, I've always had this problem and it bugs the hell out of me. Does anybody know any HTML or CSS tricks to get rid of this?
put this:

Code: Select all

<style>
.imgBlock &#123; display:block &#125;
</style>

...html here
  <td><img class="imgBlock" src="whatever.gif" /></td>
...html continues etc...
Let me guess... you're using Netscape / Mozilla?
Post Reply