How do I make a css class applied to certain table element?

Posted on 2011-05-01
Last Modified: 2012-05-11
How do I set a css class style so that all hyperlinks in the table block is of certain color and hover action.

eg. red hyper link, hover to green

This will only be effective of this particular table class, to override the global setting for other elements on the same page.
Question by:jay28lee
    1 Comment
    LVL 15

    Accepted Solution

    First you should define a class for such table. Like

    /*write attributes*/
    and now you can apply different style
    .tablediff .classlink a {
     color:#900;//or your color
    .tablediff .classlink a:hover{
     color:#090; //or your color for hover

    Open in new window

    To implement it:
    <table class="tablediff">
    <tr><td class=classlink><a href="#">Test</a></td></tr>

    Open in new window


    Featured Post

    Course: HTML5 Specialist

    HTML5 development skills are critical to all developers. HTML5 is the foundation to almost any development process. That's why business, design studios, development shops and other organizations need HTML5 developers. Get your foot in the door as a HTML5 specialist.

    Join & Write a Comment

    Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
    When applying CSS to your HTML, there are many different ways to select which element(s) the CSS applies to.  Some of these selectors are more commonly known and used than others - Here are the more common ones: #X - Matches an ID of X .X - Matche…
    In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
    In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now