How do I underline a table header?

J

Jedi

Hi

I have a table that I want to have borders for only certain lines. Is it
possible to have borders around each cell but only for the header, or at
least just underline the first line?

Thanks,
bodi
 
D

David Dorward

Jedi said:
I have a table that I want to have borders for only certain lines. Is it
possible to have borders around each cell but only for the header, or at
least just underline the first line?

Assuming you mean rows, something like this will probably do the trick:

thead th { border-bottom: solid 0.25em black; }

(Along with good markup:

<table>
<thead><tr><th scope="col">Col 1</th><th scope="col">Col 2</th></tr></thead>
<tbody>
<!-- table data -->
</tbody></table>)
 
J

Jedi

thx

I can't figure out where to put the "thead th { border-bottom: solid 0.25em
black; }" line you mentioned. I tried in the head, in the body in the thead
tag istelf, etc. Forgive my ignorance.. This is great, so that means I can
use border-bottom, border-top, border-left, right?

Thanks,
Bodi
 
T

Toby A Inkster

Jedi said:
I have a table that I want to have borders for only certain lines. Is it
possible to have borders around each cell but only for the header, or at
least just underline the first line?

th {
border-bottom: medium dotted blue;
}
 
P

Paul Furman

Jedi said:
thx

I can't figure out where to put the "thead th { border-bottom: solid 0.25em
black; }" line you mentioned. I tried in the head, in the body in the thead
tag istelf, etc. Forgive my ignorance.. This is great, so that means I can
use border-bottom, border-top, border-left, right?

Take a look at the source for this page:
http://www.edgehill.net/plant-list.htm
 
J

Jedi

Paul my man. You sent me to a page that was very daunting at first. I got
over my fear of examining it, dug in and HOLY CRAP, you ROCK. THANK YOU. I
understand now, even more than I asked for, I can totally custmoize witht
this style thing. Awesome, thank you. Good luck with your landscaping.

Bodi
 
P

Paul Furman

David said:
Paul Furman wrote:




It might be wise to fix the syntax errors in the style sheet... and the
strange use of a physical unit (pt) for screen media.


Thanks, I know it's probably a mess but better than my earlier pages!
I should probably warn people I'm not that great <g>.

Hmm.. only 287 errors:
http://validator.w3.org/check?uri=http://www.edgehill.net/plant-list.htm
(but no complaints about the css in the header)


8: <style type="text/css">
9: a { text-decoration: none}
10: a:link {color: #9B4457}
11: a:visited {color: #6633CC}
12: a:hover {color: #339966}
13: a:active {color: red}
14:
15: body {
16: font-family: Times New Roman;
17: }
18:
19: table.arial {
20: font-size: 8pt;
21: font-family: Arial;
22: background-color=#CCD8CD;
23: border=1px solid #aaaaaa;
24: border-collapse: collapse;
25: }
26: td.arial {
27: border=1px solid #aaaaaa;
28: }
29: </style>

Hm... most of the errors were for failing to close my bold tag <b>
inside <td>'s and also something about being unable to identify the
%nbsp space character and the fancy 6 9 quotes pasted from an MS app.
 
D

David Dorward

Paul said:
Hmm.. only 287 errors:
http://validator.w3.org/check?uri=http://www.edgehill.net 2Fplant-list.htm
(but no complaints about the css in the header)

Well there wouldn't be would there? Not from the _HTML_ validator!
8: <style type="text/css">
9: a { text-decoration: none}
10: a:link {color: #9B4457}
11: a:visited {color: #6633CC}
12: a:hover {color: #339966}
13: a:active {color: red}

No background colour specified when a background is
14:
15: body {
16: font-family: Times New Roman;

Fonts with spaces in the names must be quoted. Where's the generic font
family?
17: }
18:
19: table.arial {

Bad class name. Try to describe the purpose of the class, not its
appearence.
20: font-size: 8pt;

Pt are good for paper, worse then awful for the screen.
21: font-family: Arial;

No generic font family.
22: background-color=#CCD8CD;

Its ":" not "="
Background specified but no foreground colour
23: border=1px solid #aaaaaa;

Again its ":" not "="
 

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

Forum statistics

Threads
474,261
Messages
2,571,040
Members
48,769
Latest member
Clifft

Latest Threads

Top