Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tables, backgrounds and 1px cells

Status
Not open for further replies.

gwar2k1

Programmer
Apr 17, 2003
387
GB
I have a table, with a bgcolor, cell spacing of 1, padding of 0 and borders of 0. The cell bgcolor is different so you can see an outline.
I want a cell to be 1 pixel in height but it just wont happen. Can anyone help me?

~*Gwar3k1*~
"To the pressure, everything's just like: an illusion. I'll be losing you before long..."
 
try putting in the cell a 1px X 1px transparent gif.

DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Also avoid putting spaces or line breaks in your table markup, i.e. do it like this
[tt]
<tr><td><img src=&quot;/images.spacer.gif&quot; height=&quot;1&quot; width=&quot;1&quot;></td></tr>
[/tt]

-- Chris Hunt
Extra Connections Ltd

The real world's OK for a visit, but you wouldn't want to LIVE there!
 
=D Thanks!

That 1 line thing per row, is that standard? what if you have a lot of columns in a row?

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
But how would i do this with a style sheet?

~*Gwar3k1*~
&quot;To the pressure, everything's just like: an illusion. I'll be losing you before long...&quot;
 
If you have lots of columns in your table, just put a colspan attribute in the <td> in question:
[tt]
<table>
<tr><td colspan=&quot;2&quot;><img src=&quot;/images.spacer.gif&quot; height=&quot;1&quot; width=&quot;1&quot;></td></tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
[/tt]

As to CSS, well, in theory you should be able to put
[tt]
<td style=&quot;height:1px&quot;>
[/tt]
But that only sets a minimum height for the cell. If the cell contains anything that's too big (like, for instance, a space) the browser will resize the cell to accommodate it. So stylesheets aren't all that helpful in fixing a cell to 1 pixel high. You will find them useful for defining border widths and colours, which might be a better way of doing whatever it is you're trying to do.

-- Chris Hunt
Extra Connections Ltd

The real world's OK for a visit, but you wouldn't want to LIVE there!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top