PDA

View Full Version : html/css tables question


raisinbread
01-26-2003, 01:17 PM
Is it possible to make a table in HTML that has a line along one side of the table? For example the left, bottom and right side of the table will have no visible border but the top side will have a 1px #000000 line for its breadth.
I'm assuming such a beast would be done with style sheets. Will this be rendered correctly by all browsers, save Netscape 4.7* or would this convention be particular to a single browser like IE?

raisinbread
01-26-2003, 01:26 PM
Oh yes, is it possible to add justification to text in HTML or does one have to have ragged line breaks?

Armilla
01-26-2003, 01:28 PM
Try something like :


<table border="0" width="100%" style="border-left:1px solid #000000">


Works in IE, but probably not in Netscape (I don't have 4.7 handy).

A more compatible option might be to insert a 1pixel wide black cell at the left of the table, spanned across the rows.

black rabbit
01-26-2003, 01:29 PM
In the stylesheet:


table#foo {
border-top : 1px #000 solid; }


In the body:


<table id="foo" etc...>


Now that I think about it, you might have to do it with individual cells. In that case, make it td#foo instead of table#foo, and apply the id property to the cells on the first row of the table.

It should work in IE, Gecko, Opera, and Khtml, afaik.

Armilla
01-26-2003, 01:33 PM
You can also justify text with the text-align CSS attribute.


<span style="text-align:justify>
Justified text in here
</span>

black rabbit
01-26-2003, 01:40 PM
As for justification, theres the text-align : justify; property. You have to use it with block level elements, ie, <p>, <td>, <blockquote>, etc.

It doesn't work well in Navigator 4, but then again, nothing does.

black rabbit
01-26-2003, 01:42 PM
Originally posted by Armilla
You can also justify text with the text-align CSS attribute.


<span style="text-align:justify>
Justified text in here
</span>


It won't work in a span, which is a line level element. You'll need to use a div.

Armilla
01-26-2003, 01:46 PM
Originally posted by black455
It won't work in a span, which is a line level element. You'll need to use a div.

Works for me.

Achernar
01-26-2003, 01:48 PM
<table style="border-width: 1px 0 0 0; border-color: black">
<tr>
<td style="text-align: justify">
Jusified text in here.
<td>
This text inherits its alignment from the parent element.
<td style="text-align: right">
Right-jusified text in here.
</table>

If you want your whole page justified, I suggest making it part of the body tag, and letting everything inherit:

<body style="text-align: justify">

mazzer
01-26-2003, 03:14 PM
If you want something more brower-independent, you can go without style sheets altogether.

<table>
<tr height="1">
<td height="1" colspan="3" bgcolor="#000000"></td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>You will have to adjust your colspan according to how many columns you have. Not elegant, but that's how it used to be done.