Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
a:link and css question
Old 07-18-2002, 02:49 PM a:link and css question
Experienced Talker

Posts: 39
Location: Toronto, Canada
Trades: 0
Still getting my feet wet with css, so I need some advice.

If in my css I specify a:link then all text links will take on the parameters that I specified. That's great. But what happens when I have text links on a page that need to be different colors? For example, I may want text links to be blue. But I may also have text links in an area that has a blue bg. So in that case, I'd want a different color like white.

Anyone know how to specify more than 1 color for text links?

Thanks for your help.

Vito
__________________

Please login or register to view this content. Registration is FREE
- Now you can actually see the traffic on your web site in real time...as it happens.
vito is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-18-2002, 03:54 PM
david's Avatar
King Spam Talker

Posts: 1,314
Location: Glasgow, UK
Trades: 0
This can be done using Classes. You set a up a stylesheet class for these links and then include a class attribute in the <a> tag for the links:
http://www.freewebmasterhelp.com/tut...ets/index3.htm
__________________

Please login or register to view this content. Registration is FREE
- Everything a webmaster needs - for free

Please login or register to view this content. Registration is FREE
- Free web hosts reviewed and rated

Please login or register to view this content. Registration is FREE
- Impartial hosting directory - Add your host today for FREE
david is offline
Reply With Quote
View Public Profile
 
Old 07-18-2002, 04:02 PM
Experienced Talker

Posts: 39
Location: Toronto, Canada
Trades: 0
Thanks David:
Not 30 seconds ago I found the answer as well at Joe Burns' site of HTMLGoodies, but I'll keep the link you supplied for future reference as well (can never have enough tut sites bookmarked...)

Thanks again.

Vito
__________________

Please login or register to view this content. Registration is FREE
- Now you can actually see the traffic on your web site in real time...as it happens.
vito is offline
Reply With Quote
View Public Profile
 
Old 07-22-2002, 12:46 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Not only do you have to use normal classes but also psuedo classes I think they are called. This means you can have:
----------------------------------------
<style type="text/css">
a:link #myLayer { color:#ffffff; }
</style>
...
...
<div id="myLayer">
<a href="blah1.html>blah</a><br />
<a href="blah2.html>blah</a><br />
<a href="blah3.html>blah</a><br />
</div>
----------------------------------------

Instead of this:
----------------------------------------
<style type="text/css">
a.myClass:link { color:#ffffff; }
</style>
...
...
<a href="blah1.html class="myClass">blah</a><br />
<a href="blah2.html class="myClass">blah</a><br />
<a href="blah3.html class="myClass">blah</a><br />
----------------------------------------
The advantages to using the first is two-fold. One, you don't have to type as much and therefore it means a smaller document size. And two, it is much easier if you had to change the names of the classes. On the first one you would have to only change 2 instances of the name of the layer where in the second you would have 4 instances to change the class name if you needed to do so, Hope this helps.
-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Old 07-22-2002, 07:57 AM
Novice Talker

Posts: 6
Trades: 0
You can also just use span classes between the <a> tags:

<a href="blah.php"><span class="NormalTextLink">click here</span></a>

the span tag will cancel out the <a> tag's formatting.
__________________

Please login or register to view this content. Registration is FREE
: Get the best viral marketing tool on the planet and watch your visitor count skyrocket!
SiteTell.com is offline
Reply With Quote
View Public Profile
 
Old 07-23-2002, 12:59 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Ok I dunno if anyone cares about how valid their code is but since the XHTML and HTML4.01 specs have been introduced by the w3c it is now frowned upon to use a block level element such as <span> or <div> inside any inline or formatting elements such as <a>, <b>, <i>, ect. Although this method with the <span> inside the <a> works in IE currently it is not going to be supported in future browsers and is very risky if you are going to try and support browsers like NS or Opera since their ability to handle code errors is far more inferior to IE's handling of the same errors.
-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Old 07-26-2002, 09:44 AM
Novice Talker

Posts: 8
Location: Canberra, Australia
Trades: 0
Not quite, dk01. You're right that block-level elements cannot be contained within inline elements or <p>.

However, <span> is *not* a block-level element.
See:
http://htmlhelp.com/reference/html40/block.html
http://htmlhelp.com/reference/html40/inline.html
http://www.w3.org/TR/html401/struct/...html#edef-SPAN
__________________
The manual said I needed to use Windows 95, or better. So, I used Linux.
mgallagher is offline
Reply With Quote
View Public Profile
 
Old 07-26-2002, 05:43 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Trades: 0
Hey sorry about that. I knew span wasn't block level. I dunno why I wrote that lol. My apologies!
-dk
__________________
Did I help you? If so, be nice and throw me some
Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
dk01 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to a:link and css question
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.26936 seconds with 12 queries