1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Multiple link styles

Discussion in 'CSS' started by genevieve, Aug 8, 2005.

  1. #1
    Is there another way to control what style a link is in, other than putting the class in the "a" tag for every link you want styled that way? I'd like to be able to make an entire table, or table cell, styled in a certain way so that I don't have to put that code in every time.

    For example, I have links that appear at the very bottom of the page ("about," "contact," etc.) which I have set as being bright blue and lowercase when not active. When someone is hovering over them, an underline appears. For all other links on the page (more "main" ones), they appear in all-caps, grayed-out, then are highlighted in green when you are hovering.

    So far, I have a style for "a":

    a:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    color: #6C6C6C;
    text-decoration: none;
    }

    (There is CSS for hover, visited, etc. as well, but I don't think I need to post it unless someone needs it.)

    And a style for the bottom links, called signature:

    .signature:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10px;
    text-transform: lowercase;
    color: #6C6C6C;
    text-decoration: none;
    }

    So far I've just been putting class="signature" in the "a" tag for every link in the bottom line. Why can't I style a "td" tag, or a table tag, or something, so that I don't have to put the class in every new link I put in? (This would also make it so that if someone other than me added a link, I wouldn't end up with a link styled differently because they didn't know to put in the code.)

    Any ideas??

    Thanks!
     
    genevieve, Aug 8, 2005 IP
  2. Design Agent

    Design Agent Peon

    Messages:
    3,061
    Likes Received:
    154
    Best Answers:
    0
    Trophy Points:
    0
    #2
    .sidemenu {
    CSS SETTINGS;
    }

    .sidemenu a {
    CSS SETTINGS;
    }
    ---------------------
    .topmenu {
    CSS SETTINGS;
    }

    .topmenu a {
    CSS SETTINGS;
    }

    Try something along those lines.
     
    Design Agent, Aug 8, 2005 IP
  3. genevieve

    genevieve Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Design Agent - I'm not sure I understand you. The CSS code I am using seems to work, it just won't work to define a whole table as one style. When I define a style for a table, it seems to style the plain text, but not the links. Here is an example of what I mean:
    "http://www.butlertech.org/glc/links.asp"

    It uses the style sheet test3.css
     
    genevieve, Aug 9, 2005 IP
  4. Arnica

    Arnica Peon

    Messages:
    320
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You would have to modify the css selector to pick up the links within the table like this:
    .signature a:link{
     font-family: Arial, Helvetica, sans-serif;
     font-size: 10px;
     text-transform: lowercase;
     color: #0000FF;
     text-decoration: none;
    }
    
    Code (markup):
     
    Arnica, Aug 9, 2005 IP
  5. Kevinat308

    Kevinat308 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Genevieve

    I have been struggling with this problem for the past day or so and I think the answer
    is in using the <div class=xxx> tag. This avoids having to place the
    classs="Main" in all the <a href...> tags


    Example:


    <TABLE width="100%" align="center" border="0" bgcolor="#FFFFCC" class="Main">

    <div class="Main">

    <tr>
    <td width="20%" align="center" >
    <a href="./Alaska2004/Alaska.htm">
    <img src="./Alaska2004/tn_RussSheepCreek.jpg" width="100"><br>Alaska Trip 2004</a>
    </td>

    <td width="20%" align="center" >
    <a href="./OswegoRiver/Oswego.htm">
    <img src="./OswegoRiver/tn_BobKevinOswegoDamn1203_jpg.jpg" width="100"><br>Oswego</a>
    </td>

    <td width="20%" align="center" >
    <a href="./MaxwellCreek/Maxwell.htm">
    <img src="./MaxwellCreek/tn_PC200496Rainbow.jpg" width="100"><br>Maxwell Creek</a>
    </td>


    <td width="20%" align="center" >
    <a href="./MunroWatercolors/index.html">
    <img src="./MunroWatercolors/Landscapes/tn_Monumentvalley_jpg.jpg" width="100"><br>Munro Watercolors</a>
    </td>

    <td width="20%" align="center" >
    <a href="./Paris/Paris.htm">
    <img src="./Paris/tn_TheSeine_jpg.jpg" width="100"><br>3 Days in Paris</a>
    </td>

    </tr>
    </div>

    </Table>
     
    Kevinat308, Aug 30, 2005 IP