...

View Full Version : a href twice



cooldaddy
12-13-2005, 06:53 PM
Hi, Is it possible to use two different a href styles within one html document.

If so, can anyone give me an example ?

JamieR
12-13-2005, 07:15 PM
In CSS:




.one a {
text-align:center;
color:#000;
}

.two a {

text-align:left;
color:#FF0000;
}

Just have a different class for each different style.

cooldaddy
12-14-2005, 08:40 AM
ok, ive tried this:

<html>
<head>
<title>Untitled</title>
<style type="text/css">
.one a {
text-align:center;
colour:#000;
}

.two a {

text-align:left;
color:#FF0000;
}
</style>

</head>
<body>
<a href="uu" class="one">test 1</a>
<a href="yy" class="two">test 2</a>


</body>
</html>

but it doesnt seem to work ? Am i doing something wrong ?

_Aerospace_Eng_
12-14-2005, 09:34 AM
<html>
<head>
<title>Untitled</title>
<style type="text/css">
a.one {
color:#000;
}

a.two {
color:#FF0000;
}
</style>

</head>
<body>
<a href="uu" class="one">test 1</a>
<a href="yy" class="two">test 2</a>


</body>
</html>
The code weezel posted was if the link was inside of another element that had those classes, the way you did the html requires that the class be applied to the a in the CSS. Also CSS is all in the American english language.

Pennimus
12-14-2005, 01:17 PM
The code weezel posted was if the link was inside of another element that had those classes, the way you did the html requires that the class be applied to the a in the CSS. Also CSS is all in the American english language.


ie, your hierarchies are the wrong way round. You need to either nest your <a> tags inside a div of the appropriate class, or change the css declaration to




<style type="text/css">
.one a {
color:#000;
}

.two a {
color:#FF0000;
}
</style>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum