Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Dyl
    Dyl is offline
    New Coder
    Join Date
    Jun 2011
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post

    Table Caption Help

    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:
    Code:
    <!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>

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,760
    Thanks
    41
    Thanked 191 Times in 190 Posts
    because that is what the caption tag does caption tag 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.

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    Dyl
    Dyl is offline
    New Coder
    Join Date
    Jun 2011
    Posts
    21
    Thanks
    0
    Thanked 1 Time in 1 Post
    My bad! I read through the chapter. Just ignore this thread!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •