|
INTERVIEW QUESTIONS
WEB
CSS
DETAILS
Question: Why is it my ':hover' declaration for links does not work ?
Answer: Assuming you have already checked that your style sheet declarations do conform to correct CSS syntax, it could be that you have overlooked the importance of a correct order of style declarations for links. The CSS2 specification makes this following note on the importance of placing the dynamic pseudo-classes ':hover' and ':active' in correct positions in a list of style declarations. Note that the 'a:hover' must be placed after the 'a:link' and 'a:visited' rules, since otherwise the cascading rules will hide the 'color' property of the 'a:hover' rule.
Similarly, because 'a:active' is placed after 'a:hover', the active color will apply when the user both activates and hovers over the 'a' element.
|
|
|
Category |
CSS Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.2) By 8656 users |
Added on |
9/4/2014 |
Views |
72140 |
Rate it! |
|
|
Question:
Why is it my ':hover' declaration for links does not work ?
Answer:
Assuming you have already checked that your style sheet declarations do conform to correct CSS syntax, it could be that you have overlooked the importance of a correct order of style declarations for links. The CSS2 specification makes this following note on the importance of placing the dynamic pseudo-classes ':hover' and ':active' in correct positions in a list of style declarations. Note that the 'a:hover' must be placed after the 'a:link' and 'a:visited' rules, since otherwise the cascading rules will hide the 'color' property of the 'a:hover' rule.
Similarly, because 'a:active' is placed after 'a:hover', the active color will apply when the user both activates and hovers over the 'a' element. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
Why does Netscape lose my styles ?
|
View Answer
|
|
Which font names are available on all platforms ?
|
View Answer
|
|
What is Extensible Stylesheet Language (XSL)?
|
View Answer
|
|
Document Style Semantics and Specification Language (DSSSL)?
|
View Answer
|
|
How can I specify two different sets of link colors?
|
View Answer
|
|
How do you show which page you're on (in a menu)?
|
View Answer
|
|
How do you override the underlining of hyperlinks?
|
View Answer
|
|
If one were to set Text and Link colors using a style sheet, should one also define the background colors for these elements as well?
|
View Answer
|
|
Why are there gaps above and below my form in IE?
|
View Answer
|
|
How does a simple CSS style rule look ?
|
View Answer
|
|
How does a simple CSS style rule look ?
|
View Answer
|
|
How do I move the list bullet to the left/right?
|
View Answer
|
|
I want my page fonts to look the same everywhere as in… a) Why are my font sizes different in different browsers ? b) Why are my font sizes different on different platforms ?
|
View Answer
|
|
Can you use someone else's Style Sheet without permission?
|
View Answer
|
|
How do I place two paragraphs next to each other?
|
View Answer
|
|
I made a 10px-high div, but IE makes it 20px high...
|
View Answer
|
|
To what are partial URLs relative?
|
View Answer
|
|
Do URL's have quotes or not?
|
View Answer
|
|
Why can @import be at the top only?
|
View Answer
|
|
Justified Text?
|
View Answer
|