|
INTERVIEW QUESTIONS
PROGRAMMING LANGUAGES
HTML
DETAILS
Question: How can I have two sets of links with different colors?
Answer: You can suggest this presentation in a style sheet. First, specify colors for normal links, like this:
a:link {color: blue; background: white} a:visited {color: purple; background: white} a:active {color: red; background: white}
Next, identify the links that you want to have different colors. You can use the CLASS attribute in your HTML, like this:
<a class="example1" href="[URL]">[link text]</a> Then, in your style sheet, use a selector for links with this CLASS attribute, like this:
a.example1:link {color: yellow; background: black} a.example1:visited {color: white; background: black} a.example1:active {color: red; background: black}
Alternatively, you can identify an element that contains the links that you want to have different colors, like this:
<div class="example2">... <a href="[URL]">[link text]</a>... <a href="[URL]">[link text]</a>... <a href="[URL]">[link text]</a>... </div>
Then, in your style sheet, use a selector for links in this containing element, like this:
.example2 a:link {color: yellow; background: black} .example2 a:visited {color: white; background: black} .example2 a:active {color: red; background: black}
|
|
|
Category |
HTML Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 6652 users |
Added on |
9/14/2014 |
Views |
71478 |
Rate it! |
|
|
Question:
How can I have two sets of links with different colors?
Answer:
You can suggest this presentation in a style sheet. First, specify colors for normal links, like this:
a:link {color: blue; background: white} a:visited {color: purple; background: white} a:active {color: red; background: white}
Next, identify the links that you want to have different colors. You can use the CLASS attribute in your HTML, like this:
<a class="example1" href="[URL]">[link text]</a> Then, in your style sheet, use a selector for links with this CLASS attribute, like this:
a.example1:link {color: yellow; background: black} a.example1:visited {color: white; background: black} a.example1:active {color: red; background: black}
Alternatively, you can identify an element that contains the links that you want to have different colors, like this:
<div class="example2">... <a href="[URL]">[link text]</a>... <a href="[URL]">[link text]</a>... <a href="[URL]">[link text]</a>... </div>
Then, in your style sheet, use a selector for links in this containing element, like this:
.example2 a:link {color: yellow; background: black} .example2 a:visited {color: white; background: black} .example2 a:active {color: red; background: black} 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 |
|
How do I create a link that sends me email?
|
View Answer
|
|
Why is there extra space before or after my table?
|
View Answer
|
|
Why doesn't <TABLE WIDTH="100%"> use the full browser width?
|
View Answer
|
|
Can I use percentage values for <TD WIDTH=...>?
|
View Answer
|
|
How can I use forms for pull-down navigation menus?
|
View Answer
|
|
How can I use tables to structure forms?
|
View Answer
|
|
How can I eliminate the extra space after a </form> tag?
|
View Answer
|
|
How do I set the focus to the first form field?
|
View Answer
|
|
How do I make a form so it can be submitted by hitting ENTER?
|
View Answer
|
|
Do I have to memorize a bunch of tags?
|
View Answer
|
|
How can I check for errors?
|
View Answer
|
|
How do I use forms?
|
View Answer
|
|
How do I center a table?
|
View Answer
|
|
How can I use tables to structure forms?
|
View Answer
|
|
How do I align a table to the right (or left)?
|
View Answer
|
|
Can I nest tables within tables?
|
View Answer
|
|
What is a DOCTYPE? Which one do I use?
|
View Answer
|
|
What is everyone using to write HTML?
|
View Answer
|
|
How comfortable are you with writing HTML entirely by hand?
|
View Answer
|
|
How comfortable are you with writing HTML entirely by hand?
|
View Answer
|
Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.
View All HTML Interview Questions & Answers - Exam Mode /
Learning Mode
|