border on table

liunx

Guest
I have a table and I want to border it using css instead of the html border=1.


How can I do this?<style type="text/css">
<!--
#table_id {border:1px solid #000;}
-->
</style><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>

<style type="text/css">
<!--
table {background-color:#000}
th, td {background-color:#fff; padding:1ex}
-->
</style>

</head>
<body>
<table>
<thead>
<tr><th span="col">Heading</th><th span="col">Heading</th></tr>
</thead>
<tbody>
<tr><td>data</td><td>data</td></tr>
<tr><td>data</td><td>data</td></tr>
</tbody>
</table>
</body>
</html>charles: how can I set for just one specific table?

Also it is putting black in cells that have nothing in them and I want it to be white.<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>

<style type="text/css">
<!--
#table1 {background-color:#000}
#table1 th, #table1 td {background-color:#fff;}
-->
</style>

</head>
<body>
<table id="table1">
<thead>
<tr><th span="col">Heading</th><th span="col">Heading</th></tr>
</thead>
<tbody>
<tr><td>data</td><td>data</td></tr>
<tr><td>data</td><td> </td></tr>
</tbody>
</table>
</body>
</html>
Place a &nbsp; in empty cellsCharles the span attribute is only allowed in colgroup and col, with an integer value :confused:what if there are a few cells that I don't want borders on? Any way to do this?Originally posted by Fang
Charles the span attribute is only allowed in colgroup and col, with an integer value :confused: Consarn it. I meant "scope (<!-- m --><a class="postlink" href="http://www.w3.org/TR/html401/struct/tables.html#adef-scope">http://www.w3.org/TR/html401/struct/tab ... adef-scope</a><!-- m -->)".<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Content-Script-Type" content="text/javascript">
<meta name="Content-Style-Type" content="text/css">
<title>Example</title>

<style type="text/css">
<!--
#table1 th, #table1 td {border:1px solid #000}
.noborder {border:0;}
-->
</style>

</head>
<body>
<table id="table1">
<thead>
<tr><th scope="col">Heading</th><th scope="col">Heading</th></tr>
</thead>
<tbody>
<tr><td>data</td><td>data</td></tr>
<tr><td>data</td><td class="noborder"> </td></tr>
</tbody>
</table>
</body>
</html>
 
Back
Top