different stylesheets in the same page

windows

Guest
I have attached a stylesheet to a page to control the appearance of my links. This style, though, controls all the links, is there a way to have certain links behave accordingly to some other stylesheet that I will create?<!--content-->you can only have one style sheet for a page. you can however have classes for each link<br />
<br />
.first{text-decoration: none}<br />
.second{background-color: blue}<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"link.html" class="first">link 1 </a><br />
<a href=http://www.htmlforums.com/archive/index.php/"link.html" class="second">link 2 </a><br />
<br />
<br />
the second one wil have a blue background and the other opne shouldn't. that is a class and you can have as many as you want.<!--content-->How do you take into account if a link has been visited using the class option?<!--content-->actually I had it a little backwards. it should be like this<br />
<br />
A { font: 12px arial, verdana, helvetica, sans-serif; }<br />
A:link { color: #0011BB; text-decoration: none; }<br />
A:visited { color: #0011BB; text-decoration: none; }<br />
A:hover { color: #605040; text-decoration: underline; }<br />
<br />
A.second { font: 12px arial, verdana, helvetica, sans-serif; }<br />
A.second:link { color: #FFFFFF; text-decoration: none; }<br />
A.second:visited { color: #FF0000; text-decoration: none; }<br />
A.second:hover { color: #c0c0c0; text-decoration: underline; }<br />
<br />
and then it will still be the same in the links itself.<br />
<br />
<a href=http://www.htmlforums.com/archive/index.php/"link.html">link 1 </a> <br />
<a href=http://www.htmlforums.com/archive/index.php/"link.html" class="second">link 2 </a><!--content-->yeah, got it, thanks, man!<!--content-->you can only have one style sheet for a page. you can however have classes for each link <br />
This is not true. You can have as many style sheets per page as you want. The problem occurs when more than one style sheet define the same attributes. The way it generally works is the last one defined is the one that takes precedence.<br />
<br />
Doog Xela<!--content-->just read what you just said. "the last one defined takes precedence." that means you can only use one, as the other ones don't matter because the browser will only use the last one. also it is the same as defining a external style sheet adn then using inline styles - the inline style takes precedence and will over write the external.<!--content-->You are missing a fine point. The attributes defined in the first sheet that are not defined in the second sheet are still used. This allows you to use one style sheet for a basic layout, and then define special attributes for individual pages using a separate sheet.<br />
<br />
For example, if an external style sheet has this:<br />
<br />
h3 <br />
{<br />
color: red;<br />
text-align: left;<br />
font-size: 8pt<br />
}<br />
<br />
and an internal style sheet has this:<br />
<br />
h3 <br />
{<br />
text-align: right; <br />
font-size: 20pt<br />
}<br />
<br />
then, if the page with the internal style sheet links to the external style sheet, the properties for h3 will be:<br />
<br />
color: red; <br />
text-align: right; <br />
font-size: 20pt<br />
<br />
<br />
Doog Xela<!--content-->I understand what you are saying. do you have a link that says this? I was under the impression it takes the last one and goes with it.<!--content-->Here (<!-- m --><a class="postlink" href="http://www.w3schools.com/css/css_howto.asp">http://www.w3schools.com/css/css_howto.asp</a><!-- m -->) is the page from whence came the exapmle I used. And yes, I did basically copy and paste their example, but I'm at work, so I didn't want to spend the time to come up with a unique example.<br />
<br />
Doog Xela<!--content-->ok thanks, learn something new everyday. :cool:<!--content-->
 
Back
Top