...

View Full Version : <img height="0">



Evlich
12-15-2002, 05:23 AM
Hello, I am using <img> tags with 0 height and a set width without a src to make sure that certain things are big enough when I use %'s for widths. The problem is when I do this, you can't see the img, but it takes up too much vertical space. Can anyone tell me what i could do about this? Thanks a lot.

jv00123
12-15-2002, 05:39 AM
well, you arent going to see the image if the height is 0 (if that was one of the problems). i dont think it should show any vertical space, but if you post the html i could look at it and it would be easier to solve your problem.

Evlich
12-15-2002, 07:00 PM
Here is the code that I am currently using:


<body>
<img width="800" class="spacer"/>
<table class="header" rows="2" cols="2" cellspacing="0" width="100%" cellpadding="0" height="120">

The declaration for the spacer class is:


img.spacer {height: 0px; border: 0px 0px 0px 0px; margin: 0px;}

Any ideas? Thanks a lot.

jv00123
12-15-2002, 07:19 PM
well, i know if you dont define the height when using a defined width, that it assumes the same dimension for the height. So, if you define the table's height as something other than 0, it will be that height.

<img width="800" class="spacer" height="20"/>
<table class="header" rows="2" cols="2" cellspacing="0" width="100%" cellpadding="0" height="theheightyouwant">

Evlich
12-16-2002, 01:51 AM
So you are saying that the style defined is not working?

cg9com
12-16-2002, 02:11 PM
why not place the width and height in the css
also, you have the border specifying every side, if its all the same why not just use shorthand like you did with the margin?
border:0px;

Íkii
12-16-2002, 02:24 PM
height and width are deprecated attributes of the table tag - should only appear in <td> tags.

any element (even a 0px high image) is assumed to be rendered in a line conforming to the parental font specs.


.spacer {font-size:1px}

should help assure that any line break below the image (new tr of br) doesn't cause as much vertical space.

Evlich
12-17-2002, 01:57 AM
Ok, that didn't work and I am refering to the <img>, not to the table. Any other ideas.

A1ien51
12-17-2002, 04:05 AM
first off use a 1x1 invisible pic as your source. As mentioned above: A 0 Pixel height means it will do nothing at all.

Evlich
12-22-2002, 06:16 AM
Ok, I got it to work in IE with the following:


<img width="800" height="1" src="transparent.gif"/><br style="line-height: 1px; font-size: 1px;"/>

But it still doesn't work in Netscape 7. Any ideas?
Thanks a lot.

zoobie
12-22-2002, 06:38 AM
Any img with a 1 px size will be frowned upon in search engines. The reason is that ppl stuff alt tags in there...Sorry...Better figure out an better way unless you don't care about search engines. :o

Evlich
12-22-2002, 04:05 PM
If it will be frowned upon than do you have any other way to accomplish the same thing without an image? I want to make the table with my content 100%, but I never want it to be smaller than 800px wide. Thanks a lot.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum