Solved

html, css, javascript, and jquery

Posted on 2014-01-16
4
318 Views
Last Modified: 2014-02-05
a.black:hover,a.black:active
{
    color:white;
    background:black
}

 <table width="100%" cellpadding="2" cellspacing="0">
           <tr><td class="leftNavFormat"><a class="black"  href="Default.aspx">Home</a></td></tr>
 </table>

I have above codes working fine. It highlights the text in black. But now I want to hightlights all background colors within
<td></td>. How can do that?
0
Comment
Question by:CoolDev2014
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Neil_Bradley
Comment Utility
Do you have a test page that you are working on that might contain the rest of your CSS?
Are you trying to make the black background colour that shows on the hover state fill the entire td that is wrap around your link?
Try
a.black:hover,a.black:active
{
    color:white; 
    background:black;
	display:block
}

Open in new window

0
 
LVL 58

Expert Comment

by:Gary
Comment Utility
td a:hover,td a:active
{
    color:white;
    background:black
}
0
 
LVL 42

Accepted Solution

by:
Chris Stanyon earned 500 total points
Comment Utility
There is no 'parent' selector in CSS, so you can't target the TD tag when you hover over the A tag (not with CSS anyway - you could it with jQuery!)

Neil's on the right track - you will need to make the A tag fill the TD and then your CSS hover code will highlight the A tag, filling the TD :)

You may want to style the A tag to display:block in it's default state, rather than just on hover and active otherwise you may have some 'jumps' when you hover.
0
 
LVL 5

Expert Comment

by:Neil_Bradley
Comment Utility
Spot on Chris.
Again, a test page showing us the css you have used for your table will help us a a lot.
Neil
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now