table row borders

D

dx

How do you display only the horizontal borders (grid lines) in a table. What
is the css settings?

Much thanks in advance.
Stan
 
M

Mitja

dx said:
How do you display only the horizontal borders (grid lines) in a
table. What is the css settings?

Much thanks in advance.
Stan

td {
border-top: solid black 1px; /*for example*/
border-right: solid black 1px;
border-bottom: solid black 1px;
border-left: solid black 1px;
}

or, shorter:

td {
border: solid black 1px;
border-width: 1px 0;
}

See w3c specs.

Mitja
 
J

Jay

Mitja said:
td {
border-top: solid black 1px; /*for example*/
border-right: solid black 1px;
border-bottom: solid black 1px;
border-left: solid black 1px;
}

or, shorter:

td {
border: solid black 1px;
border-width: 1px 0;
}

See w3c specs.

The OP wanted only horizontal borders.

td {
border-top: solid black 1px;
border-bottom: solid black 1px;
}

--
"Some see the glass as half-empty;
some see the glass as half-full.
I see the glass as too big." - George Carlin

- J
 
H

Hywel

The OP wanted only horizontal borders.

Then the OP can work it out from the example given. What if next week
the OP wants to know how to do vertical borders?
td {
border-top: solid black 1px;
border-bottom: solid black 1px;
}

That will give 2 pixel wide borders, apart from at the top and bottom of
the table.
 
M

Mitja

Jay said:
The OP wanted only horizontal borders.

td {
border-top: solid black 1px;
border-bottom: solid black 1px;
}

My bad. Copy-pasted the first line four times without thinking.
The second, better example, though, does what OP intended. Or at least
partially - as it's been pointed out, it makes for 2-px borders.
 
S

Sid Ismail

:
: : > dx <[email protected]>
: > (wrote:
: > > How do you display only the horizontal borders (grid lines) in a
: > > table. What is the css settings?
: > >
: > > Much thanks in advance.
: > > Stan
: >
: > td {
: > border-top: solid black 1px; /*for example*/
: > border-right: solid black 1px;
: > border-bottom: solid black 1px;
: > border-left: solid black 1px;
: > }
: >
: > or, shorter:
: >
: > td {
: > border: solid black 1px;
: > border-width: 1px 0;
: > }
: >
: > See w3c specs.
:
: The OP wanted only horizontal borders.
:
: td {
: border-top: solid black 1px;
: border-bottom: solid black 1px;
: }


Remember to put border-collapse:collapse in the table CSS definition.

Sid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top