After reading a few tutorials, it looks like this:
http://www.rpi.edu/~doriad/Examples/Table/

should make a full (100%) width table. However, the width is actually very small and the table is on the left of the page.

Does anyone see what is wrong here?

Thanks,
Dave

Recommended Answers

All 4 Replies

post the code,
including the css
that you are using

we dont do homework, nobody is going to look it up, fix it, and post it for you
but we do show the bugs in what you have tried

almostbob,

The link I posted was my code. Here it is directly on the forum:

index.html

<html>
<head>
<link href="table.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>

<table>
        <!--headers-->
        <tr>
        <th>Firstname</th>
        <th>Lastname</th>
        </tr>

        <!--First row-->
        <tr>
        <td>Peter</td>
        <td>Griffin</td>
        </tr>

        <!--Second row-->
        <tr>
        <td>Lois</td>
        <td>Griffin</td>
        </tr>
</table>

</body>
</html>

table.css

/* th = table header, td = table data */

table
{
width:100%;
}

th
{
height:50px;
text-align:center;
}

td
{
height:50px;
text-align:center;
}

~Dave

with no dtd you are limited to html2
self closed elements (end in /> ) are xhtml ONLY
the declaration of your css wil lbe ignored

if you make the firstline of the html file a dtd for html 4 (strict or transitional) or xhtml (strict or transitional) you will be able to properly use external css files <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> sample html4 Transitional DTD
course notes are never complete

commented: Thanks almostbob +3
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html>
<head>
<link href="table.css" rel="stylesheet" type="text/css" media="screen" >
</head>
<body>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
</tr>
</table>
</body>
</html>

should function
whitespace and indenting are not required for production code and should be removed
often 40-50% of the filesize downloaded to the user browser is whitespace
Its ok as an aid to developer, but a code highlighting notepad is better.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.