...

View Full Version : Table Caption Help



Dyl
07-06-2011, 04:47 PM
This is my code so far and it does NOT work. It puts the caption above the table and doesn't include it inside the table:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Fix Table</title>
<meta http-equiv="Content-Language" content="English" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
body{
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color:#75a54b;
color:#f18359;
margin:50px 25px;
}
.shadow {
position: relative;
top: -1px;
left: -1px;
width: 660px;
margin: auto;
background: #000;
}
table{
position: relative;
top: -3px;
left: -3px;
width: 660px;
border:1px solid #131313;
background-color:#ffffff;
margin:auto;
}
table th {
background-color: #FFC5AF;
color: #75a54b;
}
table th, table td {
margin: 0;
padding: 0px 90px 0px 30px;
text-align: center;
border-bottom: 1px solid #b5b5b5;
}
table .left {
text-align: left;
}
table tr.alt {
background-color: #CCCCCC;
}
-->
</style>
</head>

<body>
<div class="shadow">
<table cellspacing="0">
<caption><img src="kulinarylogo.jpg" alt="KulinaryKidz" width="238" height="47" /><br />
Site Statistics<br /><br /><br /></caption>
<thead>
<tr>
<th class="left" scope="col"><strong>Month</strong></th>
<th scope="col"><strong># of Visitors</strong></th>
<th scope="col"><strong>Avg. Visit Stay</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td class="left">May</td>
<td>258</td>
<td>2 (mins)</td>
</tr>
<tr class="alt">
<td class="left">April</td>
<td>350</td>
<td>5 (mins)</td>
</tr>
<tr>
<td class="left">March</td>
<td>150</td>
<td>1 (mins)</td>
</tr>
<tr class="alt">
<td class="left">Feb.</td>
<td>125</td>
<td>3 (mins)</td>
</tr>
<tr>
<td class="left">Jan.</td>
<td>50</td>
<td>1 (mins)</td>
</tr>
</tbody>
</table>
</div>
</body>

</html>

alykins
07-06-2011, 04:51 PM
because that is what the caption tag does caption tag (http://www.w3schools.com/tags/tag_caption.asp) and to quote from the site (so you don't have to search for it)


The <caption> tag must be inserted immediately after the <table> tag. You can specify only one caption per table. Usually the caption will be centered above the table.

Dyl
07-06-2011, 04:58 PM
My bad! I read through the chapter. Just ignore this thread!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum