View Full Version : Targeting CSS


tarq
07-03-2003, 02:39 PM
Hello, I don't link to external stylesheets because I only use a small amount of CSS but theres a link on my page and I want that to use different CSS attributes from the rest of the page is that possible? Is there a way or targeting CSS? If you don't understand what I mean post back! Thank you for any replies :)

Kaliyoda
07-03-2003, 03:32 PM
Sure you can :D

Just set up a few different styles like this....


<STYLE type="text/css">
<!--
#linkstyle1 { font-weight: bolder; color: #ff0000 }
#linkstyle2 { color: #0000ff }
-->
</STYLE>


Then to display a link in a particular style....

<a href-"filetolinkto.htm" id="linkstyle1">Your text</a>

CuJo
07-03-2003, 04:53 PM
<a href-"filetolinkto.htm" id="linkstyle1">Your text</a>

you can also use

<a href-"filetolinkto.htm" class ="linkstyle1">Your text</a>

Kaliyoda
07-03-2003, 05:04 PM
Yes - you can - but you'd have to define a class using a period (.) rather than an ID using a hash (#)

tarq
07-03-2003, 05:41 PM
Wait problem. Its a guestbook and I've just realised the CSS is setup differently here than on my site. The CSS code on this page to control the links is like this:
<BODY BGCOLOR="#FB9F53" TEXT="#636363" LINK="#636363" VLINK="#636363">
But I want to change the CSS of a link I have placed at the top of the page. The reason is it doesn't need to be seen so I want to change it to the same colour as the background but obviously I don't want all the other links to do this because they are necessary. So is is possible to add the CSS to that link like you can on a form? Thanks for your help so far!

YellowYoshi
07-04-2003, 03:20 AM
Yes you can. Just add the font tag to the link, like this:

<a href="blah"><font size="#" color="#######" face="verdana" style="blah">Stuff Here</font></a>

YellowYoshi
07-04-2003, 03:22 AM
And one more thing, the attributes in the <body> tag aren't CSS.

tarq
07-04-2003, 10:42 AM
Thanks YellowYoshi thats great just what I wanted!

:D