Solved

html, css, javascript, and jquery

Posted on 2014-01-16
4
323 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
ID: 39786486
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
ID: 39786533
td a:hover,td a:active
{
    color:white;
    background:black
}
0
 
LVL 43

Accepted Solution

by:
Chris Stanyon earned 500 total points
ID: 39791352
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
ID: 39791756
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
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…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

828 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