473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Different colors for heading links?

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.
Jul 21 '05 #1
6 7044
On Mon, 28 Feb 2005 15:39:54 +0100, Pasi Kovanen
<ko***@nospam.iki.fi.invalid> 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.


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
Jul 21 '05 #2
"Pasi Kovanen" <ko***@nospam.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.

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

--
Spartanicus
Jul 21 '05 #3
Spartanicus <me@privacy.net> wrote:
"Pasi Kovanen" <ko***@nospam.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.
A page should contain one level one header,
Normally yes, but there are exception, e.g. a genuinely bilingual page.
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.
and it's content should relate to the page it's on,
Certainly.
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?
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/
Jul 21 '05 #4
Spartanicus wrote:
"Pasi Kovanen" <ko***@nospam.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.
Jul 21 '05 #5
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;">
Jul 21 '05 #6
Richard wrote:
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.
Jul 21 '05 #7

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

Similar topics

3
2510
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,...
1
1948
by: news.microsoft.com | last post by:
When I add to a listview, can the text I have be of different colors? For example, I want to add these two lines to my list view: "This is my program" "This is my other program" Can I add...
4
2754
by: VM | last post by:
Can I add text of different colors to a listview? Let's say I want to add, on one line, the text "This is my message" on my listview. Would it be possible to add this sentence to the listview...
4
10988
by: Jon Pope | last post by:
Many of my users have their sound cards muted, so I need some way of alerting them visually that a message box has appeared on a form that could be hidden beneath other open applications. I've...
3
1274
by: Carlos Arra via .NET 247 | last post by:
In the same dropdownlistbox, I need bold, italic and different colors in if possible...any help is appreciated. -------------------------------- From: Carlos Arra -----------------------...
1
1536
by: VMI | last post by:
Can the Windows datagrid in VS.Net '05 have rows of different colors? I'm trying to build an Outlook-style scheduler and I need to emulate the Calendar so that the rows change colors based on the...
0
1304
by: Ken Lameki | last post by:
Hi guys, Needed to know how to display items on a listview and the items on the same listview appear in different colors, say e.g items that need immediate attention are flagged in red for...
11
1865
by: zionlion | last post by:
Can anyone point out the error in this script? I have tried so many times but haven't been successful. <html> <body> <? $colors=ARRAY(...
9
2439
by: Kristal Y | last post by:
Hello, I've been searching over lots of forums for this solution and I can't seem to make any of the solutions work for me. This is my first time I'm posting a question and I'm also far from a css...
0
7260
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
7384
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
5685
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,...
1
5086
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4746
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
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...

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.