473,395 Members | 1,623 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Override CSS Link Color?

Have a web site which uses a CSS file. There is one link which I would like
to change the colors for the A:link, A:visited, and A:hover. Is there
something I can put in the HTML code to override the CSS values?
Jul 24 '05 #1
2 69740
Al Franz wrote:
Have a web site which uses a CSS file. There is one link which I would
like
to change the colors for the A:link, A:visited, and A:hover. Is there
something I can put in the HTML code to override the CSS values?


These changes do not belong into the HTML code. The purpose of external CSS
files is to keep such presentational stuff seperate from the document.

The only thing you need to change in your HTML is adding a 'class' attribute
to this special link, e.g.
<a class="specialLink" href="...">...</a>

Then add rules in your CSS file like

a.specialLink:link { color: white; }
a.specialLink:visited { color: black; }
a.specialLink:hover { color: red; }

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Jul 24 '05 #2
On Mon, 20 Jun 2005 14:20:20 -0700, "Al Franz"
<al****@nospam.netmation.com> wrote:
Is there something I can put in the HTML code to override the CSS values?


The "C" in "CSS" stands for "Cascading". The whole protocol is designed
to allow this to be done easily.

Use an in-line stylesheet like this:

<html><head>

< ... existing stuff .. >

<style type="text/css" >

a:link {
}
a:visited {
}
a:hover {
}
a:active {
}

</style>

</head>

More stuff....

With CSS' default behaviour, you'll still use the existing external
stylesheet, but you'll overwrite these specific rules with the internal
stylesheet. This obviously only applies to a page which contains this
internal stylesheet.

If you don't want to do this to all links, start using a class attribute
on them. If you want to do it to multiple pages, also consider using
class, with an external stylesheet.

The order of the pseudo-classes :hover etc. is significant.

Go read a good book, like Lie & Bos, on CSS
Jul 24 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: jfburr | last post by:
very simple thing (I hope) I've got a css style sheet that starts like this: ______________ A:link { color: cc9933; }
0
by: Andrea | last post by:
Hi everyone. I'm working on a navigation menu (in a frameset) that I want to set the "active" link to black (the link that corresponds to the page displayed in the right side of the frame) to...
3
by: Mason A. Clark | last post by:
This link is given in another thread: http://www.ccmeonline.org/agenda.html My Opera 7.23 in Windows XP will only show the links as black on gray. Not recognizable as links, although they...
1
by: kj | last post by:
I want to specify the color of certain style sheet element (say p.foo) to match the color of (unvisited) hyperlinks: p.foo { color: ??? } What should I replace ??? with to ensure that the...
4
by: crhaynes | last post by:
I'm having trouble with my CSS. My links are black, my hover is orange and my active link is red. When I select a link it turns red but i does not retain that color when the selected page loads. ...
2
by: Sheila King | last post by:
I have a test/mock-up page here: http://mathxy.com/dev/index.htm and I've set one link on the dark-blue menu bar the "Home" link that comes first and it is blue font, but should not be. ...
3
by: SStory | last post by:
I have a style sheet for my site. It has various classes in it. It has <A: styles defined for all anchor tags. I have a datagrid in ASP.NET with a stylesheet linked to the page. It defines...
1
beacon
by: beacon | last post by:
I'm looking to reset the visited link color once another link is selected. Also, once that link takes me to a particular page, I want the font-weight for that page to be bold to indicate that it's...
2
by: Garima12 | last post by:
There is htm page. In its body I am calling a class from stylesheet called TaskbarStyle(classname). Now I want to change the color of hyperlink in this page as well as their active link color. I am...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.