HighDots Forums  

Different colors for heading links?

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss Different colors for heading links? in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pasi Kovanen
 
Posts: n/a

Default Different colors for heading links? - 02-28-2005 , 09:39 AM






How do I define for example link inside H1 style to
be of different color than other links in the same page:

<a href="blah">this is some color</a>
<h1><a href="blahblah">this is different color</a></h1>

I remember seeing suitable code for this a couple of years
ago but wasn't able to google my way to it.



Reply With Quote
  #2  
Old   
Rijk van Geijtenbeek
 
Posts: n/a

Default Re: Different colors for heading links? - 02-28-2005 , 09:56 AM






On Mon, 28 Feb 2005 15:39:54 +0100, Pasi Kovanen
<kovis (AT) nospam (DOT) iki.fi.invalid> wrote:

Quote:
How do I define for example link inside H1 style to
be of different color than other links in the same page:

a href="blah">this is some color</a
h1><a href="blahblah">this is different color</a></h1

I remember seeing suitable code for this a couple of years
ago but wasn't able to google my way to it.
a:link, a:visited {color: one;}
h1 a:link, h1 a:visited {color: two;}


--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won't get any real work done. - J.Nielsen


Reply With Quote
  #3  
Old   
Spartanicus
 
Posts: n/a

Default Re: Different colors for heading links? - 02-28-2005 , 10:34 AM



"Pasi Kovanen" <kovis (AT) nospam (DOT) iki.fi.invalid> wrote:

Quote:
a href="blah">this is some color</a
h1><a href="blahblah">this is different color</a></h1
That's almost certainly incorrect markup. A page should contain one
level one header, it should precede all other content, and it's content
should relate to the page it's on, consequently it's content should not
be linked.

If you are attempting to boost search engine position then stop it.

--
Spartanicus


Reply With Quote
  #4  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: Different colors for heading links? - 02-28-2005 , 12:16 PM



Spartanicus <me (AT) privacy (DOT) net> wrote:

Quote:
"Pasi Kovanen" <kovis (AT) nospam (DOT) iki.fi.invalid> wrote:

a href="blah">this is some color</a> <h1><a href="blahblah">this is
different color</a></h1

That's almost certainly incorrect markup.
I wouldn't jump into that conclusion. But let's first note that it is
surely valid markup, at least in HTML 4.01 Transitional. Second, I'm not
sure Pasi really meant that there's a lonesome link right before the h1
element - rather, he meant that his page has normal links that aren't
inside headings and some links that appear in headings.

Quote:
A page should contain one level one header,
Normally yes, but there are exception, e.g. a genuinely bilingual page.

Quote:
it should precede all other content,
No, not at all. There's quite often some content before it. Maybe a site
logo, maybe some contextual information, quite often with links. Often
there's much too much content before the main heading, but that's a
different issue.

Quote:
and it's content should relate to the page it's on,
Certainly.

Quote:
consequently it's content should not be linked.
Non sequitur. It might not be a good idea to make a heading link, but I
wouldn't condemn the idea entirely. I cannot figure out why someone would
make the entire h1 heading a link, but there _might_ be a good reason.

Wait... consider this: A page consists of a photo of a person and some
short personal information. Would it be wrong to put the name of the person
at the beginning and use h1 markup for it? (It's maybe not optimal, but is
it _wrong_?) And would it be wrong to make the name a link to the person's
personal home page?

Quote:
If you are attempting to boost search engine position then stop it.
Well, that would apply to _dishonest_ boosting only.

Regarding the CSS techniques, Rijk's answer was a bit sketchy and
potentially misleading in its excessive compactness. The distinction
between unvisited, visited, active, and hovered links should not be lost,
and background should always be specified when specifying color, so the
full scheme would be something like

a:link {color: one1; background: white}
a:visited {color: one2; background: white}
a:link:hover, a:visited:hover {color: one3; background: white}
a:link:active, a:visited:active {color: one4; background: white}

h1 a:link {color: two1; background: white}
h1 a:visited {color: two2; background: white}
h1 a:link:hover, a:visited:hover {color: two3; background: white}
h1 a:link:active, a:visited:active {color: two4; background: white}

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Reply With Quote
  #5  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Different colors for heading links? - 02-28-2005 , 05:26 PM



Spartanicus wrote:
Quote:
"Pasi Kovanen" <kovis (AT) nospam (DOT) iki.fi.invalid> wrote:


a href="blah">this is some color</a
h1><a href="blahblah">this is different color</a></h1


That's almost certainly incorrect markup. A page should contain one
level one header, it should precede all other content, and it's content
should relate to the page it's on, consequently it's content should not
be linked.
Ya know, I strongly suspect that this person had no intention of posting
a real web page whose major heading is a link reading "this is a
different color", preceded by an unblocked link reading "this is some
color".

Conversely, if you're going to jump on the innocent even on ad hoc
illustrative examples, then it was very sloppy of you not to have nailed
him as well for the missing DOCTYPE and TITLE.

Oh, and I've had rare instances where it made sense for some of the
headings on a page (though, granted, not a level 1 heading) also to be
hyperlinks.


Reply With Quote
  #6  
Old   
Harlan Messinger
 
Posts: n/a

Default Re: Different colors for heading links? - 03-01-2005 , 07:03 AM



Richard wrote:
Quote:
On Mon, 28 Feb 2005 16:39:54 +0200 Pasi Kovanen wrote:

How do I define for example link inside H1 style to
be of different color than other links in the same page:

a href="blah">this is some color</a
h1><a href="blahblah">this is different color</a></h1

I remember seeing suitable code for this a couple of years
ago but wasn't able to google my way to it.

h1 style="color:red;"
a style="color:green;"
Well, sure, if one is going to follow bad practices.


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.