45 users online (0 members and 45 guests)  


  Results 1 to 7 of 7

Related

  1. Fortec Codes    Forum: Myspace Forum
    Replies: 0
  2. music codes    Forum: HTML Forum
    Replies: 2
  1. #1
    asker123's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    4

    Question Need the CSS codes for...

    I am new to CSS and I am trying to set a style for my page's tables as follows:

    For the <TD> element, I want to have two styles (some TD's would have "style1" others would have "style2"), here's an example:

    Style1: I want the font size=5, font type=times, bold and italic font, red color font, and the text centered at the middle.

    Style2: I want the font size=7, font type=sans-serif, bold font, color=#F0F0F1, centered text, and I want a line to appear under links when cursor hovers over them.

    That's for the <TD>.

    For the <TBODY> element, I want the font type=times, size=7, color=#060F06.

    Can you help me with the FULL CSS codes, please!

  2. #2
    vinyl-junkie's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    721

    Re: Need the CSS codes for...

    Welcome to the forum, asker123.

    Do you want alternating row colors, or just alternating column colors? Alternating row colors will involve a little server side scripting, whereas alternating column colors will be strictly CSS.

    Please clarify what you're trying to do so we can tell you how to do this.
    Music Around The World - Collecting tips, trade
    and want lists, album reviews, & more

  3. #3
    asker123's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    4

    Re: Need the CSS codes for...

    Thanks vinyl-junkie! But I don't think I understand what you mean by alternating row/column colors!
    I want to specify the color of the text.
    I don't want any server side scripting. Just CSS.

  4. #4
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Need the CSS codes for...

    Hi there asker123,
    does this help...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>table css</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    color:#000;
    background-color:#eef;
    }
    table {
    border:2px solid #999;
    margin:20px auto;
    }
    td {
    width:216px;
    height:134px;
    border:1px solid #000;
    }
    #the_body {
    font-family:'times new roman',serif; 
    font-size:48px; 
    color:#060f06;
    background-color:#fff;
    }
    .style1 {
    font-family:'times new roman',serif;
    font-size:24px;
    font-weight:bold;
    font-style:oblique;
    color:#f00;
    background-color:#fff;
    text-align:center;
    }
    .style2 {
    font-family:verdana,sans-serif;
    font-size:48px;
    font-weight:bold;
    color:#f0f0f1;
    background-color:#fff;
    text-align:center;
    }
    -->
    </style>
    </head>
    <body>
    <table>
    <tbody id="the_body">
    <tr>
    <td class="style1">style1</td><td class="style2">style2</td>
    </tr><tr>
    <td>tbody</td><td>tbody</td>
    </tr><tr>
    <td class="style2">style2</td><td class="style1">style1</td>
    </tr>
    </tbody></table>
    </body>
    </html>

  5. #5
    asker123's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    4

    Re: Need the CSS codes for...

    Thanks coothead! That's very helpfull!
    But there's a little problem: I want to apply style2 to a link (<a> element) but I want the link not to be underlined in the normal status (when the cursor is out) and gets underlined when the cursor hovers over it. What code should I add to style2?

  6. #6
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732

    Re: Need the CSS codes for...

    Hi there asker123,
    try this...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>table css</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    color:#000;
    background-color:#eef;
    }
    table {
    border:2px solid #999;
    margin:20px auto;
    }
    td {
    width:216px;
    height:134px;
    border:1px solid #000;
    }
    #the_body {
    font-family:'times new roman',serif; 
    font-size:48px; 
    color:#060f06;
    background-color:#fff;
    }
    .style1 {
    font-family:'times new roman',serif;
    font-size:24px;
    font-weight:bold;
    font-style:oblique;
    color:#f00;
    background-color:#fff;
    text-align:center;
    }
    .style2, a {
    font-family:verdana,sans-serif;
    font-size:48px;
    font-weight:bold;
    color:#f0f0f1;
    background-color:#fff;
    text-align:center;
    text-decoration:none;
    }
    a:hover {
    text-decoration:underline;
    }
    -->
    </style>
    </head>
    <body>
    <table>
    <tbody id="the_body">
    <tr>
    <td class="style1">style1</td>
    <td class="style2">
    <div>style2</div>
    <div><a href="#">a link</a></div>
    </td>
    </tr><tr>
    <td>tbody</td><td>tbody</td>
    </tr><tr>
    <td class="style2">
    <div>style2</div>
    <div><a href="#">a link</a></div>
    </td><td class="style1">style1</td>
    </tr>
    </tbody></table>
    </body>
    </html>
    You may find this site useful for extending your CSS skills...
    w3schools - CSS
    Last edited by coothead; 01-16-2006 at 06:44 AM. Reason: Typing error.

  7. #7
    asker123's Avatar
    New User

    Status
    Offline
    Join Date
    Jan 2006
    Posts
    4

    Re: Need the CSS codes for...

    Thanks a lot coothead!



Tags for this Thread