Solved

over-riding css style for anchor tags

Posted on 2002-06-10
4
299 Views
Last Modified: 2012-05-04
in a .css file i have defined anchor properties (hover, visited etc.)

how can i over-ride these settings in certain parts of an html page that uses this .css file?

e.g. use different hover colors etc.

thanks.
0
Comment
Question by:loyaliser
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Batalf
Comment Utility
You could use a class

.myclass{text-decoration:none;color:#ff0000;}
.myclass:hover{text-decoration:underline;color:#000000;}

0
 
LVL 32

Accepted Solution

by:
Batalf earned 50 total points
Comment Utility
And of course use that class in some of your <a> tags

<a href="whatever" class="myClass"....
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
Comment Utility
Just specify a different class for each section of the page then you do not have to specify a class for each link:

<html>
<title> multi-links </title>
<head>
<style media="screen" type="text/css">
   .class1 a:link { color: blue }
   .class1 a:visited { color: blue }
   .class1 a:hover { color: blue}
   .class2 a:link { color: white }
   .class2 a:visited { color: white }
   .class2 a:hover { color: white }
</style>
</head>

<body>
<div class="class1">

... content for the first part of the page  ...
 
<div class="class2">

... content for the second part of the page

</div>
</font>
</body>
</html>
The div wrapped around the links for each section of the page will cause the links in that section to inherit the specification contained in that class.

Cd&
0
 
LVL 1

Author Comment

by:loyaliser
Comment Utility
that's the ticket!

thanks...
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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…

771 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

15 Experts available now in Live!

Get 1:1 Help Now