[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 11-13-2007, 09:56 AM   #1 (permalink)
NamePros Regular
 
vivsin's Avatar
 
Join Date: Oct 2005
Posts: 984
1,567.95 NP$ (Donate)

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?
__________________
VIVSIN | NatGeo for WebMasters Visit : My Web Development Blog :kickass:

This is where I started, This is where I will end. NAMEPROS = :kickass:
vivsin is offline  
Old 11-13-2007, 10:27 AM   #2 (permalink)
Munky Designs
 
Join Date: May 2005
Posts: 997
417.00 NP$ (Donate)

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, 11:59 AM   #3 (permalink)
Joe
Senior Member
 
Join Date: Oct 2005
Location: Kent ~ U.K.
Posts: 3,246
88.85 NP$ (Donate)

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.
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; }
Joe is offline  
Old 11-13-2007, 12:05 PM   #4 (permalink)
NamePros Regular
 
vivsin's Avatar
 
Join Date: Oct 2005
Posts: 984
1,567.95 NP$ (Donate)

vivsin is just really nicevivsin is just really nicevivsin is just really nicevivsin is just really nice

Diabetes
SOLVED, thank you everyone.
__________________
VIVSIN | NatGeo for WebMasters Visit : My Web Development Blog :kickass:

This is where I started, This is where I will end. NAMEPROS = :kickass:
vivsin is offline  
Old 11-14-2007, 11:09 PM   #5 (permalink)
i love automation
 
xrvel's Avatar
 
Join Date: Nov 2007
Posts: 1,409
987.78 NP$ (Donate)

xrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud ofxrvel has much to be proud of


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 01:17 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85