NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page How to use 2 different CSS styles for links in same page

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-13-2007, 10:56 AM THREAD STARTER               #1 (permalink)
Senior Member
 
vivsin's Avatar
Join Date: Oct 2005
Posts: 1,093
vivsin is just really nicevivsin is just really nicevivsin is just really nicevivsin is just really nice
 


Diabetes

Question How to use 2 different CSS styles for links in same page


OK the scenerio is, I use external CSS to format text in my webpages.

to style my links i create one class like this

a { tags }

and this get applied to whole page.

The problem:

Now i want to keep default style for links but also want to use different style for the links in header section only,

so how to do this?
__________________
VIVROCKS "ROCK your LIFE" Visit : My Design Inspiration & Free Stuff Blog

This is where I started, This is where I will end. NAMEPROS = kIcKaSs
vivsin is offline  
Old 11-13-2007, 11:27 AM   #2 (permalink)
Munky Designs
Join Date: May 2005
Posts: 996
Albino is a jewel in the roughAlbino is a jewel in the roughAlbino is a jewel in the rough
 



you can wrap them in tags, so for instance:

<div id="header">
<a href="blah">link</a>
</div>

then have in the css:

#header .a{
link styling
}

that will work, or I think you can do this:

<a href="blah" class="linkclass">link</a>

then in the css

.linkclass{
link style
}
Albino is offline  
Old 11-13-2007, 12:59 PM   #3 (permalink)
Joe
Senior Member
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,209
Joe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud ofJoe has much to be proud of
 


Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Here is a working example which you can just paste into a file and modify to your needs.
????: NamePros.com http://www.namepros.com/programming/395398-how-use-2-different-css-styles.html
HTML Code:
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
	<title>Changing links.</title>
	<style>a { text-decoration: underline; color: green; } #header a { text-decoration: none; color: blue; }</style>
</head>

<body>
<div id="header"><a href="http://www.namepros.com">NamePros.com</a></div>
<br />
<br />
<a href="http://www.google.com">Google.com</a>
</body>
</html>
Note, this can be used for anything else as well, including:
Code:
#header a:active, #header a:visited { ... }
or
Code:
#idhere tag { ... }
#header input { background-color: #ff6600; }
__________________
Myself and "JackHeskett" are no longer associated with FusedHosting.net. Please pipe all PMs to admin [at] fusedhosting.net.
Joe is offline  
Old 11-13-2007, 01:05 PM THREAD STARTER               #4 (permalink)
Senior Member
 
vivsin's Avatar
Join Date: Oct 2005
Posts: 1,093
vivsin is just really nicevivsin is just really nicevivsin is just really nicevivsin is just really nice
 


Diabetes
SOLVED, thank you everyone.
__________________
VIVROCKS "ROCK your LIFE" Visit : My Design Inspiration & Free Stuff Blog

This is where I started, This is where I will end. NAMEPROS = kIcKaSs
vivsin is offline  
Old 11-15-2007, 12:09 AM   #5 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,620
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 




you can use :

Code:
<style>
a.black { color : #000000; }
a.red { color : #FF0000; }
</style>

<a href="#" class="black"> Black </a>
<a href="#" class="red"> red </a>
xrvel is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 05:47 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger