Jump to content

link double color


andrejanubis

Recommended Posts

Hello, lets say we have:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head>  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />  <style type="text/css">	body { background: black; color:white; }	a { font-size:22px; text-decoration:none; }	a:link { color:blue; }	a:visited { color:pink; }	a:hover { color:black; background:white; font-weight: bold; }	a:active { }  </style></head><body><a href="http://www.w3schools.com">www.<span style="color:#ff0000">w3scho - hoverd should be black - ols</span>.com</a></body></html>

I would like the link in page to be blue except the part w3schools to be redwhen mouse is over the link I would like entire link to be black on white backgroundthank you

Link to comment
Share on other sites

If you want all of the link text to be block when hover, then you need to take out the inline style for the span tag.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head>  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />  <style type="text/css">	body { background: black; color:white; }	a { font-size:22px; text-decoration:none; }	a:link { color:blue; }	a:visited { color:pink; }	a:hover { color:black; background:white; font-weight: bold; }	a:active { }		span {	color: #ff0000;}	span:hover {	color: #000000;}  </style></head><body><a href="http://www.w3schools.com">www.<span>w3scho - hoverd should be black - ols</span>.com</a></body></html>

Link to comment
Share on other sites

The code I provided works as you requested. Maybe you made some changes that you are not aware of. Do you have a URL so I can see the results?Edit: I see what you are getting at. Try adding a class to the span tag and then change the span styles to this:

	span {	color: #000000;}	.hov {color: #ff0000;}	a:hover span.hov {	color: #000000;}

And the html to this:

<a href="http://www.w3schools.com">www.<span class="hov">w3scho - hoverd should be black - ols</span>.com</a>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...