Click to See Complete Forum and Search --> : Please help me!


valhala_90
06-17-2003, 05:30 AM
im new to css and was wondering how you use style sheets with tables?
if anyone can help i would be very grateful!
thanks

Charles
06-17-2003, 05:54 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example</title>
<style type="text/css">
<!--
table {
background-color:#900;
margin:auto;
}
th, td {
background-color:#aaa;
font-weight:normal;
padding:0.5ex;
text-align:center;
vertical-align:top;
}
th {font-style:italic}
-->
</style>
<table summary="A table showing...">
<tr>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>

valhala_90
06-17-2003, 06:49 AM
ok thanks but would you mind giving me the specific code for making the font family different? and having the table aligned in the center of the page?also, i have a caption on the table. is there a way of making the css include the caption?

Charles
06-17-2003, 06:00 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example</title>
<style type="text/css">
<!--
table {
background-color:#900;
margin:auto;
}
th, td {
background-color:#aaa;
font-weight:normal;
padding:0.5ex;
text-align:center;
vertical-align:top;
}
th {font-style:italic}

caption, th {font-family:Verdana, sans-serif}

td {font-family:Georgia, serif}
-->
</style>
<table summary="A table showing...">
<caption>Exmple</caption>
<tr>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
<th>Heading</th>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
<tr>
<td>Data</td>
<td>Data</td>
<td>Data</td>
<td>Data</td>
</tr>
</table>
<p><a href="http://validator.w3.org/check/referer"><img src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" height="31" width="88"></a></p>