HighDots Forums  

Anchor Tag. Need Advice ...

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


Discuss Anchor Tag. Need Advice ... in the Cascading Style Sheets forum.



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

Default Anchor Tag. Need Advice ... - 03-17-2009 , 02:20 PM






Hello,

Do I still need to define the anchor tag (a) when I define the
following?

div.Poll a:link,
div.Poll a:visited {
color: #424040;
font: normal 1em/2 Georgia, Utopia, Palatino, 'Palatino
Linotype', serif;
text-decoration: underline;
}
div.Poll a:hover,
div.Poll a:active,
div.Poll a:focus {text-decoration: none;}

I mean, do I need to do something like:
div.Poll a {...}

My assumption is that I use div.Poll a {...} to define all common
styles to the anchor inside the div Poll and then the link, visited,
hover, ... are defined only with the styles specific to them ...

But isn't div.Poll a:link similar to div.Poll a ?

I am a little bit confused about this.

Thanks,
Miguel

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

Default Re: Anchor Tag. Need Advice ... - 03-17-2009 , 02:37 PM






shapper wrote:

Quote:
Do I still need to define the anchor tag (a) when I define the
following?
You don't really define any tags in CSS, or even in HTML. Tags as such have
no meaning; they are only syntactic parts of elements, which may have
defined meanings.

People often refer to defining tags when they mean presenting CSS
suggestions on rendering of elements. That's really sloppy language and
tends to mislead.

Quote:
div.Poll a:link,
div.Poll a:visited {
color: #424040;
font: normal 1em/2 Georgia, Utopia, Palatino, 'Palatino
Linotype', serif;
text-decoration: underline;
}
There are some bad practices involved here: setting unvisited and visited
links to the same color, and setting color without setting background. A
line-height of 2 is excessive though it might make sense in special
situations - but you did not specify a URL.

Quote:
I mean, do I need to do something like:
div.Poll a {...}
You don't need to do anything in CSS.

And if you set properties for a:link and a:visited (in some contexts), you
cover all links. So what you are probably trying to ask has "No" as the
correct answer.

Quote:
My assumption is that I use div.Poll a {...} to define all common
styles to the anchor inside the div Poll and then the link, visited,
hover, ... are defined only with the styles specific to them ...
That's possible of course. Largely a matter of taste whether you do things
that way,

Quote:
But isn't div.Poll a:link similar to div.Poll a ?
No, the former refers to unvisited links (the name :link is really a
misnomer), whereas the latter refers to all <a> elements (including those
with no href="..." attribute). So the meanings are really quite different.

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



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

Default Re: Anchor Tag. Need Advice ... - 03-17-2009 , 02:51 PM



shapper wrote:
Quote:
Hello,

Do I still need to define the anchor tag (a) when I define the
following?

div.Poll a:link,
div.Poll a:visited {
color: #424040;
font: normal 1em/2 Georgia, Utopia, Palatino, 'Palatino
Linotype', serif;
text-decoration: underline;
}
div.Poll a:hover,
div.Poll a:active,
div.Poll a:focus {text-decoration: none;}

I mean, do I need to do something like:
div.Poll a {...}
You covered all the bases with respect to A tags used to create links
(in other words, that have an HREF attribute). The only thing that a
naked "a" would cover are the other cases, such as

<a name="something"></a>

and, usually, you don't want to style those as though they were links.


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.