Gap under images
Moderator: General Moderators
Gap under images
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?
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
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
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
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
why must people spout inefficient markup? i suggest using CSS to do the same thing:
Code: Select all
img {
padding: 0px;
margin: 0px;
border: 0px;
}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
Thank You
Andy
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
I may be new to this board but I am not new to web development.why must people spout inefficient markup?
Thank You
Andy
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
Re: Gap under images
put this: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?
Code: Select all
<style>
.imgBlock { display:block }
</style>
...html here
<td><img class="imgBlock" src="whatever.gif" /></td>
...html continues etc...