 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
iblum
Joined: 22 Aug 2005 Posts: 5
|
Posted: Mon Aug 22, 2005 10:05 am CSS link size conflict |
|
|
|
I am using Cascading Stylesheets in my website, so that I'm able to have links in different size in the same page. For example, I want regular links to be size 12 px, and links at the bottom of the document, smaller size 10 px.
I created 2 external stylesheets (so that I can use them in all the pages in the website). It seems that the 2nd stylesheet overrides the 1st one and all the links on the page are small 10 px.
The first one is mainfont.css:
a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333333;
}
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #660066;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333333;
}
.mainfont {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
}
THE SECOND ONE is smalllink.css:
a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #999999;
}
.regulartext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
I attached the stylesheets in the page:
<link href="mainfont.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
-->
</style>
<link href="smalllink.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
-->
</style>
When I have Regular links in the page, that are supposed to be size 12, they still look small - size 10 px, even though I put CLASS=mainfont:
<p class="mainfont"><a href="#" class="mainfont">test</a></p> |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
Posted: Mon Aug 22, 2005 10:24 am Re: CSS link size conflict |
|
|
|
|
| iblum wrote: |
| It seems that the 2nd stylesheet overrides the 1st one and all the links on the page are small 10 px. |
Hence the meaning of cascading styles.
You almost have it right. Try something like:
| Code: |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<style type="text/css">
a:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
}
a:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333333;
}
a:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #660066;
}
a:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #333333;
}
.mainfont {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
}
a.small:link {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a.small:visited {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a.small:hover {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
a.small:active {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #999999;
}
.regulartext {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
color: #666666;
}
</style>
</head>
<a href="http://www.cnn.com">Hyperlink One</a>
<a class="small" href="http://www.yahoo.com">Hyperlink Two</a>
<body>
</body>
</html> |
|
|
iblum
Joined: 22 Aug 2005 Posts: 5
|
Posted: Mon Aug 22, 2005 11:08 am CSS link size conflict |
|
|
|
| thanks a lot. it worked! |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
Posted: Mon Aug 22, 2005 11:20 am |
|
|
|
| Anytime - good luck with the site! |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|