Solved

Specific DIV Hyperlink Color

Posted on 2016-10-10
1
39 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 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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

758 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

19 Experts available now in Live!

Get 1:1 Help Now