Solved

Specific DIV Hyperlink Color

Posted on 2016-10-10
1
48 Views
Last Modified: 2016-10-12
Hi,
I would like to have a completely unique Hyperlink color for a page as compared to the rest of the website.
So for example, if the active hyperlink color for the website is grey, I would like the active hyperlink color on one particular page to be red.

Can someone explain how this can be done please?


Thanks!
0
Comment
Question by:canu
1 Comment
 
LVL 42

Accepted Solution

by:
zephyr_hex (Megan) earned 500 total points
ID: 41837552
Add a class to the hyperlinks on the "special" page, and then use css to target the class and specify the link color.

HTML
<a href="www.google.com" class="uniqueLink">Google</a>

Open in new window


CSS
.uniqueLink {
  color: red;
}

.uniqueLink:visited {
  color: green;
}

Open in new window


Here is a Fiddle Demo.

If you have a lot of links on the page, it may be more efficient to use a class on a container (whatever contains all of the links).  Here's an example of that approach

HTML
<div class="uniqueLink container">
     <a href="www.google.com">Google</a>
     <a href="www.yahoo.com">Yahoo</a>
</div>

Open in new window


CSS
.uniqueLink > a {
  color: red;
}

.uniqueLink > a:visited {
  color: green;
}

Open in new window


Fiddle Demo.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
media queries min-width in bootstrap not being read properly 14 47
CSS Question 9 42
Getting Column Height to Match Other Column 5 44
Error in script 11 45
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now