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 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Text placement on new table

    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

  • #2
    Regular Coder
    Join Date
    Dec 2002
    Location
    Minneapolis, MN
    Posts
    208
    Thanks
    0
    Thanked 1 Time in 1 Post
    internet browsers have default styles they apply to HTML elements. It's your job to override them.

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

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,316
    Thanks
    29
    Thanked 279 Times in 273 Posts
    Quote Originally Posted by doug2r View Post
    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.

    Quote Originally Posted by doug2r View Post
    #table2 th: {
    Why is your th selector followed by a colon character?

    Quote Originally Posted by doug2r View Post
    <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).
    Last edited by Arbitrator; 10-28-2006 at 01:34 AM. Reason: added information
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

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