Class selector, ID selectors and link pseudo-classes

  • Thread starter Luigi Donatello Asero
  • Start date
L

Luigi Donatello Asero

Does the following define the colour of all the visited links belonging to
the div class "subsection" which have an id selector "semesterbostader"?
div.subsecttion#semesterbostader > A:visited { color: blue }
 
G

Gazza

Luigi Donatello Asero mumbled the following on 04/06/2005 15:21:
Does the following define the colour of all the visited links belonging to
the div class "subsection" which have an id selector "semesterbostader"?
div.subsecttion#semesterbostader > A:visited { color: blue }

Yes, although with ID's having to be unique on a page, you could simply
drop the div.subsecttion bit:
#semesterbostader > a:visited { color: blue; }
 
L

Luigi Donatello Asero

Gazza said:
Luigi Donatello Asero mumbled the following on 04/06/2005 15:21:

Yes, although with ID's having to be unique on a page, you could simply
drop the div.subsecttion bit:
#semesterbostader > a:visited { color: blue; }


I tried this one
#italien > A:visited { display:none;}
but the visited link will be displayed on the page
https://www.scaiecat-spa-gigi.com/sv/test.html

Why?
 
T

Toby Inkster

Gazza said:
Yes, although with ID's having to be unique on a page, you could simply
drop the div.subsecttion bit:
#semesterbostader > a:visited { color: blue; }

Not neccessarily. On one page there might be:

<div id="semesterbostader" class="subsection">

and on another page, linked with the same stylesheet:

<div id="semesterbostader" class="flibble">

and on another page, linked with the same stylesheet:

<p id="semesterbostader" class="subsection">

So it might pay to be specific and include the element name and class.
 
L

Luigi Donatello Asero

Luigi Donatello Asero said:
belonging


I tried this one
#italien > A:visited { display:none;}
but the visited link will be displayed on the page
https://www.scaiecat-spa-gigi.com/sv/test.html

Why?


I think I understood it!
It seems to work now.
I have to use ">" only if to indicate a child but not a descendant
selector!
a.visited is no child, only a descendant selector of div
id="semesterbostader">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top