473,657 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Override of link colors in CSS class?

Please hlep with a very frustrating problem. I need to be able to have a
reference to my "btcopyrigh ts" CSS class override the link colors first
specified earlier in the CSS.

I inherited a large site with a CSS containing as its first lines:

A:link
{
COLOR: #006633;
BACKGROUND-COLOR: transparent;
TEXT-DECORATION: underline
}
A:visited
{ ...continuing with an entry for link, visited, hover, and active.

Later in the CSS, there is a class set up like this:

..btcopyrights
{
FONT-SIZE: 9px;
COLOR: #ffffff;
BACKGROUND-COLOR: #000000
}

I need to find a way to have the "btcopyrigh ts" CSS class override the link
colors first specified earlier in the CSS (basically to make them all
white - in this one link) - without changing the basic structure of the
CSS...something that would require code changes to hundreds of pages.

It would also require a great deal of work to change the actual link line
iteself, as it also appears in many, many pages. Somehow I need that single
line, when it uses the btcopyrights class, to simply pick up all white link
attributes.

The actual A tag link I need to have this change affect is...with normal
HTML tag delimiters < changed to [ and > changed to ]...

[td class="btcopyri ghts"]
[div align="center"> Entire Site Contents © 2006 Company Name Went Here.
All rights reserved. [A href="terms.asp " target=""] Terms of Service
[/A][/div]
[/td]
Can anyone help?

Thanks very much.

May 14 '06 #1
9 4161
"Richard" <no****@yahoo.c om> wrote:
Please hlep with a very frustrating problem. I need to be able to have a
reference to my "btcopyrigh ts" CSS class override the link colors first
specified earlier in the CSS.

I inherited a large site with a CSS containing as its first lines:

A:link
{
COLOR: #006633;
BACKGROUND-COLOR: transparent;
TEXT-DECORATION: underline
}
A:visited
{ ...continuing with an entry for link, visited, hover, and active.

Later in the CSS, there is a class set up like this:

.btcopyright s
{
FONT-SIZE: 9px;
Bad idea. IE users can't resize text sized in pixels without digging
through several menus.
COLOR: #ffffff;
BACKGROUND-COLOR: #000000
}
I need to find a way to have the "btcopyrigh ts" CSS class override the link
colors first specified earlier in the CSS (basically to make them all
..btcopyrights a:link {
color: #fff; background: #000;
}
white - in this one link) - without changing the basic structure of the
CSS...somethin g that would require code changes to hundreds of pages.
Eh? Did you mean HTML when you said CSS?

The actual A tag link I need to have this change affect is...with normal
HTML tag delimiters < changed to [ and > changed to ]...
No need to do that. Usenet is a pain text medium.
[td class="btcopyri ghts"]
[div align="center"> Entire Site Contents © 2006 Company Name Went Here.
All rights reserved. [A href="terms.asp " target=""] Terms of Service
[/A][/div]
[/td]


What's the point of the <div align="center"> ? You can just add
text-align: center; to the CSS for .btcopyrights
And what's with the target=""?

Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net > <http://steve.pugh.net/>
May 14 '06 #2
To further the education of mankind, "Richard" <no****@yahoo.c om>
vouchsafed:
Please hlep with a very frustrating problem. I need to be able to have
a reference to my "btcopyrigh ts" CSS class override the link colors
first specified earlier in the CSS.

I inherited a large site with a CSS containing as its first lines:

A:link
{
COLOR: #006633;
BACKGROUND-COLOR: transparent;
TEXT-DECORATION: underline
}
A:visited
{ ...continuing with an entry for link, visited, hover, and active.

Later in the CSS, there is a class set up like this:

.btcopyrights
{
FONT-SIZE: 9px;
COLOR: #ffffff;
BACKGROUND-COLOR: #000000
}

I need to find a way to have the "btcopyrigh ts" CSS class override the
link colors first specified earlier in the CSS (basically to make them
all white - in this one link) - without changing the basic structure
of the CSS...something that would require code changes to hundreds of
pages.
..btcopyrights, .btcopyrights a:link,.btcopyr ights a:visited,.btco pyrights
a:hover,.btcopy rights a:active {
background:blac k;
color:white;
text-align:center;
}
It would also require a great deal of work to change the actual link
line iteself, as it also appears in many, many pages. Somehow I need
that single line, when it uses the btcopyrights class, to simply pick
up all white link attributes.

The actual A tag link I need to have this change affect is...with
normal HTML tag delimiters < changed to [ and > changed to ]...

[td class="btcopyri ghts"]
[div align="center"> Entire Site Contents © 2006 Company Name Went
Here.
All rights reserved. [A href="terms.asp " target=""] Terms of Service
[/A][/div]
[/td]


Using align="..." on a div is bad. The "target" is either useless or
detrimental. Suggest:

<td class="btcopyri ghts">All rights reserved. <a href="terms.asp ">Terms
of Service</a>

--
Neredbojias
Infinity has its limits.
May 14 '06 #3
> .btcopyrights,. btcopyrights a:link,.btcopyr ights a:visited,.btco pyrights
a:hover,.btcopy rights a:active {
background:blac k;
color:white;
text-align:center;
}


I do this also:

#top-link a { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:link { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:visited { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:active { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:hover { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }

I find this easier to read (I assume the top line corresponds with the first
element of your example above - is this correct?)

When setting this stuff - should it always be done as a set, that is, all 5: a,
link, visited, active, hover? If one of these is left out (hover, for instance)
is that an error?

And what about leaving background-color out? This results in a level 1 warning
when trying to validate the CSS... but if I am using a textured background image
on the page, how do I specify a background-color??

May 15 '06 #4
To further the education of mankind, "deko" <de**@nospam.co m>
vouchsafed:
.btcopyrights,. btcopyrights a:link,.btcopyr ights
a:visited,.btco pyrights a:hover,.btcopy rights a:active {
background:blac k;
color:white;
text-align:center;
}
I do this also:

#top-link a { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:link { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:visited { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:active { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }
#top-link a:hover { text-decoration:none ; color:#CCCCCC;
font-weight:normal; }

I find this easier to read (I assume the top line corresponds with the
first element of your example above - is this correct?)


Not really. .btcopyrights is the classname for a div which has a link as
part of its content.
When setting this stuff - should it always be done as a set, that is,
all 5: a, link, visited, active, hover? If one of these is left out
(hover, for instance) is that an error?
Not really. If you're not concerned with hover or active or
differentiating visited with non-visited, 'a' is enough. If you just
wish to do the latter, a:link and a:visited will suffice. In the
originally-posted example, however, those 4 link attributes were set on
links in general so it's at least prudent to reset them all on subsequent
named or classed links.
And what about leaving background-color out? This results in a level
1 warning when trying to validate the CSS... but if I am using a
textured background image on the page, how do I specify a
background-color??


Exactly! The (supposed) high-level warning is a bogosity. I could
understand an "advisory" or something, but what choice does one have with
a random background? The validator (still) also flags "line-height:0;"
so it can be more prissy than perfect, just like it had a real but
fallible brain.

--
Neredbojias
Infinity has its limits.
May 15 '06 #5
Shortened for legibility:

a { text-deco:none; color:#00F; }
a:link { text-deco:none; color:#00F; }
a:visited { text-deco:none; color:#00F; }
a:active { text-deco:none; color:#00F; }
a:hover { text-deco:underline; color:#00F; }
I find this easier to read (I assume the top line corresponds with the
first element of your example above - is this correct?)


Not really. .btcopyrights is the classname for a div which has a link as
part of its content.


What, then, is 'a'? - and why do I need it?
When setting this stuff - should it always be done as a set, that is,
all 5: a, link, visited, active, hover? If one of these is left out
(hover, for instance) is that an error?


Not really. If you're not concerned with hover or active or
differentiating visited with non-visited, 'a' is enough. If you just
wish to do the latter, a:link and a:visited will suffice.


I see. All I really care about is that the link never changes color and I get
an underline (only) on hover.

Therefore, the below code should work - yes? (I know 'deco' is pseudo code):

a:link { text-deco:none; color:#00F; }
a:visited { text-deco:none; color:#00F; }
a:hover { text-deco:underline; color:#00F; }

Do I need to include that silly 'a'?
And what about leaving background-color out? This results in a level
1 warning when trying to validate the CSS... but if I am using a
textured background image on the page, how do I specify a
background-color??


Exactly! The (supposed) high-level warning is a bogosity. I could
understand an "advisory" or something, but what choice does one have with
a random background? The validator (still) also flags "line-height:0;"
so it can be more prissy than perfect, just like it had a real but
fallible brain.


Thanks for the clarification on this - I will stop looking for a transparent
color designation :)
May 15 '06 #6
On Mon, 15 May 2006, deko wrote:
I see. All I really care about is that the link never changes color


Fortunately, I've got a user stylesheet which will out-vote you on
that :-}
May 15 '06 #7
In article <tb************ *************** ***@comcast.com >, deko
<de**@nospam.co m> writes
a:link { text-deco:none; color:#00F; }
a:visited { text-deco:none; color:#00F; }
a:hover { text-deco:underline; color:#00F; }

Do I need to include that silly 'a'?
That "silly" 'a' is what tells the CSS that you are styling a link.
Without it, you would have a hard job setting visited and hover styles.
No, not impossible, but why make life hard on yourself?

What do have against the 'a' anyway?

<snip>Thanks for the clarification on this - I will stop looking for a
transparent color designation :)


Well, there is a value "transparen t" that you can use for color...

background-color: transparent;

but that also gives an advisory warning in the validator for the same
reasons that leaving out the declaration does!!

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
May 15 '06 #8
To further the education of mankind, "deko" <de**@nospam.co m>
vouchsafed:
What, then, is 'a'? - and why do I need it?
You don't.
When setting this stuff - should it always be done as a set, that
is, all 5: a, link, visited, active, hover? If one of these is left
out (hover, for instance) is that an error?


Not really. If you're not concerned with hover or active or
differentiating visited with non-visited, 'a' is enough. If you just
wish to do the latter, a:link and a:visited will suffice.


I see. All I really care about is that the link never changes color
and I get an underline (only) on hover.

Therefore, the below code should work - yes? (I know 'deco' is pseudo
code):

a:link { text-deco:none; color:#00F; }
a:visited { text-deco:none; color:#00F; }
a:hover { text-deco:underline; color:#00F; }


Uh huh. What I'd do is:

a:link,a:visite d { color:radish;ba ckground:celery ;text-decoration:none ; }
a:hover { text-decoration:unde rline; }
Do I need to include that silly 'a'?
For the above, I think you can:

a { color:radish;ba ckground:celery ;text-decoration:none ; }
a:hover { text-decoration:unde rline; }

(Try it and let me know.) (PS: Use real colors.)
Thanks for the clarification on this - I will stop looking for a
transparent color designation :)


I used to do like:

a:hover ( color:blue;back ground:transpar ent; }

....but the validator bolluxed that now.

--
Neredbojias
Infinity has its limits.
May 15 '06 #9
On Mon, 15 May 2006 04:11:01 -0700, "deko" <de**@nospam.co m> wrote:
I see. All I really care about is that the link never changes color and I get
an underline (only) on hover.


So why do you want to make life difficult for your visitors? (Or did you
not appreciate that that is what you are doing?)

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
May 15 '06 #10

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

Similar topics

5
2412
by: Dan Jacobson | last post by:
What's Nielsen talking about in http://www.useit.com/alertbox/20040503.html http://www.useit.com/alertbox/20040510.html Can't a good browser keep track of visited vs. unvisited link colors? Is my site deficient as I have not messed with link colors? Does Nielsen address why all this can't be left up to the browser? Are link colors supposed to be special, like background images, to make a big impression?
3
2515
by: Bart Lateur | last post by:
I want my links to look the same as the surrounding text. Can I do that without explicitely specifying the color to be used? What I'd really want to do, is disable the automatic override in links, specifically for the color, and just inherit the original color. The next appears to work on Firefox, but not in MSIE: a.plain { text-decoration: none; color: inherit;
18
10279
by: Denny Schierz | last post by:
hi, i want to change my link colors in the p class="suchen": That is my html: <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//DE" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
2
69766
by: Al Franz | last post by:
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?
4
4092
by: Franklin | last post by:
WITHOUT KNOWING ANYTHING ABOUT THE CURRENT COLORS, I want to swap the foreground/background colors of a link when someone hovers over it. Is this possible with HTML, CSS, DOM, & JavaScript? If so, how? See my HTML below (or go to my test page at http://fmbbowen.com:39353/misc/Misc.html). I also tried treating ..color as a number and subtracting the current color from 0xFFFFFF but that did not work either. The numerous examples I...
3
3140
by: Woodmon | last post by:
Example of my CSS follows: <style type="text/css" media="screen"> BODY { color: white } A:link { color: 66CCFF; } A:visited { color: CC66FF; } A:active { color: CC66FF; } A:hover { color: white; background-color: #0099cc; text-decoration: #000000;}
7
6436
by: Dave Y | last post by:
I am a newbie to C# and am having trouble trying to override a ListView property method. I have created a new class derived from the Forms.Listview and I cannot figure out the syntax to override ListView.Items.Add(), . I see that it is a virtual method so it should be easy to do. If anyone can help I would appreciate it greatly. I can do what I need to do in a different way this would just make everything significantly cleaner and eaasier...
8
11792
by: Keith Smith | last post by:
Could some one help me a little? I am trying to understand when/where you would ever want to use "protected override..." code such as this. How is this any different from creating a SelectedTextChanged type event? This is an example I found on the web... protected override void OnTextChanged(System.EventArgs e) { try
2
2361
by: jessicalgaudette | last post by:
I have been asked to change some background colors in a website that use a masterpage. This only effects 6, with each set of 2 using a different stylesheet of the many web pages, but I am having trouble trying to override the main stylesheet on the pages it effects. Can anyone point me in the right direction? Thanks!
0
8316
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8833
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8737
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8509
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.