Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Change Link Font Colours and Overriding Them For Special Cases

 
Thread Tools Search this Thread
Old 02-09-2004, 02:15 AM   #1
Default Change Link Font Colours and Overriding Them For Special Cases


Heya,

I'm trying to use these css buttons on my site,

http://www.meyerweb.com/eric/css/exa...t-buttons.html

however as soon as you have a default link colour specified by way of
a:link, it overrides the colour values set for the css buttons in their
class identifiers.

I would have thought that applying a class to a element would have given
the element those attributes and overridden any inherited of default ones.

Any idea how i can resolve this?

Hardeep.


Hardeep Rakhra
  Reply With Quote
Old 02-09-2004, 03:04 AM   #2
Els
 
Posts: n/a
Default Re: Change Link Font Colours and Overriding Them For Special Cases



Hardeep Rakhra wrote:
> Heya,
>
> I'm trying to use these css buttons on my site,
>
> http://www.meyerweb.com/eric/css/exa...t-buttons.html
>
> however as soon as you have a default link colour specified by way of
> a:link, it overrides the colour values set for the css buttons in their
> class identifiers.


to have the colours you want, you should set the style for
the a:link (and a:visited and a:hover of course if you want
those colors changed too).
So let's say the links are in a div like this:
<div class="redlinks">
<a href="home.html">

You should set the style like this:
div.redlinks a:link {color:red;}


> I would have thought that applying a class to a element would have given
> the element those attributes and overridden any inherited of default ones.


Thought right, but the a:link is not the element you gave
the style to.

Or, also possible, you did put the a:link lower in the
stylesheet than the div.redlinks a:link..
The last style is the one that applies.

When you are not sure what css styles mean and/or 'do', have
a look at this page:
http://penguin.theopalgroup.com/cgi-...electoracle.py
It translates css code into understandable english (or
spanish, german, bulgarian)
(and does a much better job than Babelfish )

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

  Reply With Quote
Old 02-09-2004, 06:58 AM   #3
Toby A Inkster
 
Posts: n/a
Default Re: Change Link Font Colours and Overriding Them For Special Cases

Els wrote:

> Or, also possible, you did put the a:link lower in the
> stylesheet than the div.redlinks a:link..
> The last style is the one that applies.


In this case, no. 'div.redlinks a:link' is more specific than 'a:link', so
it doesn't matter which order they come in, 'div.redlinks a:link' will win
out. Order only matters when the specificity of the selectors is equal.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

  Reply With Quote
Old 02-09-2004, 07:31 AM   #4
Els
 
Posts: n/a
Default Re: Change Link Font Colours and Overriding Them For Special Cases


Toby A Inkster wrote:
> Els wrote:
>
>>Or, also possible, you did put the a:link lower in the
>>stylesheet than the div.redlinks a:link..
>>The last style is the one that applies.

>
> In this case, no. 'div.redlinks a:link' is more specific than 'a:link', so
> it doesn't matter which order they come in, 'div.redlinks a:link' will win
> out. Order only matters when the specificity of the selectors is equal.


Thanks for the correction

--
Els

Mente humana é como pára-quedas; funciona melhor aberta.

  Reply With Quote
Old 02-09-2004, 04:49 PM   #5
Hardeep Rakhra
 
Posts: n/a
Default Re: Change Link Font Colours and Overriding Them For Special Cases

Els wrote:
>
> to have the colours you want, you should set the style for the a:link
> (and a:visited and a:hover of course if you want those colors changed too).
> So let's say the links are in a div like this:
> <div class="redlinks">
> <a href="home.html">
>
> You should set the style like this:
> div.redlinks a:link {color:red;}
>


Thank you Els, that helped loads!

Fixed the buttons but using spans and applying the button css to them
and enclosing the lot in a link. Then used what you described above to
remove the text decoration from all the buttons within the enclosing div.

Thanks again.

Hardeep.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump