Jump to content

<div> and embedded <a> tags... How??


ggouweloos

Recommended Posts

I have a html file, generated by a CMS, based on an own template and an own .css file.In the .css is defined:a:link, a:visited, a:hover, a:active, all with color: #ffffff;In the HTML, on one place, there is a <div> tag around an <a> tag.Like this example:

  <div class="bla">	<a href="bladieblabdie"> aksjhkasjdhkasdhkajdh </a>  </div>

The issue is that i need the <a> inside the <dib class="bla"> to be black instead of white.I tried several things, but cannot find a way to do it:

.bla {  font-style	: italic;  font-color	: #000;}.bla a {  font-color	: #000;}a.bla:link  {  font-color	: #000;}

Any help from the css-guru's out here? :)

Link to comment
Share on other sites

You might try "color" rather than "font-color".I tested this in Firefox and it works just fine:

<html><head><style>body { background-color: #ff8c00; }a { color: #ffffff; }.black a { color: #000000; }</style></head><body><a href="http://www.w3schools.com/">link1</a><div class="black"><a href="http://www.w3schools.com/">link2</a></div></body></html>

EDIT: heh, aspnetguy must have beat me by a second!

Link to comment
Share on other sites

This were very fast replies :)I got the .bla example to work.Only the real-case is more complex, and still not working.

						<div class="clr"></div>						<div class="zmg-album">							<div class="zmg-album-inner" style="width:49%">				<div class="zmg-album-image">				<a href="http://"www.**** >				<img src="http://www.****.jpg" class="zmg-image-of-album" alt="" /><br />				LINK</a><br />TempDescription</div></div></div>			<div class="clr"></div>

The problem is the same, the LINK should be displayed in black.I tried, all with no result:

.zmg-album-image a {  color: #000;}.zmg-album a  {  color: #000;}.zmg-album-inner a  {  color: #000;}

Maybe the nesting screws things up?

Link to comment
Share on other sites

In what order are you declaring the styles? Do you style the generic a elements before you style the a elements which are child elements of your div?For example:

div a { color: #000000; }a { color: #ffffff; }

Should be:

a { color: #ffffff; }div a { color: #000000; }

If this isn't the case, maybe you could post a link to your page?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...