PDA

View Full Version : Text placement on new table



doug2r
10-27-2006, 08:59 PM
I'm a newbie.

Below is the CSS definition and HTML for a simple 1 column, 1 row table. Notice the word "Testing" in the <th> tag.

What unexpectantly happens is the "Testing" is centered in the table and is in bold. How do I make the "Testing" be at the top of the table and the text be normal instead of bold?

#table2
{
background-color: white;
color: black;
width: 600px;
height: 600px;
position:absolute; left: 160px; top: 92px;
text-align: left;
vertical-align: top;
font-weight: normal;
}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="./Styles/Styles.css" rel="stylesheet" type="text/css">
<title>Untitled Document</title>
</head>

<body>
<table id=table2 width="600" border="0">
<tr>
<th scope="col">Testing</th>
</tr>
</table>

</body>
</html>

Thanks.

Doug

ez4me2c3d
10-27-2006, 09:08 PM
internet browsers have default styles they apply to HTML elements. It's your job to override them.


<style>
th { font-weight: normal; text-align: left; }
</style>

doug2r
10-27-2006, 10:19 PM
I changed my CSS specifications to:

#table2
{
font-weight: normal;
text-align: left;
height: 300px;
verticle-align: top;
color: red;
}
{
#table2 th: {
font-weight: normal;
text-align: left;
verticle-align: top;
}

and kept the HTML the same which is:

<body>
<table id=table2 width="600" border="0">
<tr>
<th scope="col">Testing</th>
</tr>
</table>

</body>

and still get the "Testing" in the center of the table cell, and it's still bold. I add a color tag of red and the Testing does display red.

Doug

Arbitrator
10-28-2006, 01:29 AM
verticle-align: top;
Why is “vertical” misspelled? Note also that if you apply this property to the table itself, it will have no effect since the vertical-align property isn’t inherited and it doesn’t affect block-level elements.


#table2 th: {
Why is your th selector followed by a colon character?


<table id=table2 width="600" border="0">Note that the width and border attributes are deprecated (obsoleted) in favor of the width and border-width CSS properties. It’s also good form to surround all of your attribute values with double quotes (even when they may not be required).