Click to See Complete Forum and Search --> : Cell padding and small images
MakTheYak
08-08-2003, 05:49 PM
Hi , I have a problem... I want to make a table cell only 1 pixel high and the width to fill the space. I also want to stretch an image to fill the total space of that cell. I thought I had the code right with this:
<td height="1" width="100%">
<img src="pics/layout/blue_dot.jpg" width="100%" height="100%">
</td>
and although the image stretches to fill the whole cell it makes the cell a lot higher than 1 pixel. I can't figure out what the problem is.
The image is only 1x1 pixel, by the way, I made sure of that...
Please help!!
PeOfEo
08-08-2003, 05:54 PM
make the image height="1"
MakTheYak
08-08-2003, 05:58 PM
thanks but that didn't seem to work... it did exactly the same thing!
PeOfEo
08-08-2003, 06:00 PM
make sure in your table tag you have cellpadding="0" if the image width="100%" it will automatically resize the height to match the images width, you if you put in a 1 as a pixil value for the height of the image then the height will not resize to match the width.
MakTheYak
08-08-2003, 06:03 PM
Here's the code I have now...
<td bgcolor=#29B6FE height="1" width="100%">
<img src="pics/layout/blue_dot.jpg" width="100%" height="1">
</td>
PeOfEo
08-08-2003, 06:08 PM
But you did make sure the padding is 0 correct?
Aronya1
08-08-2003, 06:40 PM
height="1" is not the same as height="1px"
Don't know if that's the answer, but worth a try.
MakTheYak
08-08-2003, 06:43 PM
Thanks, I tried the 1px as well (and yes the table cellpadding is set to 0). Nothing seems to work! It's really weird.
If I take the image out then it snaps back to being the right size, but with the image in it bumps up the height. I just don't get it.
PeOfEo
08-08-2003, 06:48 PM
1 is actually smaller then 1px... But here is a question are you setting any css margins or anything? Also is this on the web I would like to see it myself because it does not seem to be acting the way it should and it would be worth seeing for myself. If its not please attatch your code. Oh yea and if you are just trying to make a line try using <hr width="100%" color="#000000"></hr>
MakTheYak
08-08-2003, 06:52 PM
If you go to www.theyakshack.co.uk and in IE go to print preview you can see that the lines around the edge do not appear on the printout. That's because that's the background colour of the cell, not an image.
What I'm trying to do is stretch an image to fill those lines so that the border will print out as well.
I know it's not a big deal but it annoys me everytime I print something off!
Aronya1
08-08-2003, 07:01 PM
Have you tried adjusting the alignment on the image? Instead of the default, what happens if you add: <div align="center">?
MakTheYak
08-08-2003, 07:08 PM
That doesn't work either. Check the pic I took of the non-working code (it looks the same for everything I tried):
www.theyakshack.co.uk/temp/bad.jpg