Solved

over-riding css style for anchor tags

Posted on 2002-06-10
4
303 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 7068311
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
ID: 7068313
And of course use that class in some of your <a> tags

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

Expert Comment

by:COBOLdinosaur
ID: 7068344
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
ID: 7068370
that's the ticket!

thanks...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IF statment In Powershell 12 28
Triple line in an alert message 4 24
Calculating percentage 2 32
title attribute 5 27
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.
Find out what you should include to make the best professional email signature for your organization.
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 …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

730 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