Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

html, css, javascript, and jquery

Posted on 2014-01-16
4
Medium Priority
?
344 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 44

Accepted Solution

by:
Chris Stanyon earned 2000 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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

879 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