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.

CSS Forum


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



Reply
Can I apply styles to <a href directly...
Old 07-29-2008, 08:33 PM Can I apply styles to <a href directly...
Super Talker

Posts: 119
Trades: 0
or does it have to be done through a stylesheet or style info in the head?

The php file I have cannot use an external stylesheet, or load the info in its head section because it doesn't have one.

There are links that have style info, but i want to apply the style directly if possible.

here is the info.
Code:
.shoutbox a, .shoutbox a:visited {
color: #6E7A8A;
font-size: 12px;
font-weight: bold;
text-decoration: none;

.shoutbox a:hover {
color: #6E7A8A;
text-decoration: underline;
and here is the code for the link

PHP Code:
<a href=\"$website\" target=\"_blank\" style=\"color: #6E7A8A;font-size: 12px;font-weight: bold;text-decoration: none;\">$name</a> 
so can i apply those 2 styles to that one link?
BigJohnny is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-30-2008, 04:51 AM Re: Can I apply styles to <a href directly...
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yes you can, they are called "inline style rules"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 07-30-2008, 07:45 PM Re: Can I apply styles to <a href directly...
vangogh's Avatar
Post Impressionist

Posts: 10,688
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
You can though it's still likely better to use an external style sheet. Just add a class to the link.

<a class="shoutbox" href...

and then style the class.

a.shoutbox {}
a.shoutbox:visited {}
a.shoutbox:hover {}

If you want to use an inline style it will look like:

<a style="color:#6e7a8a; font-size:12px; etc" ...

I'm not sure if the visited or hover will work inline. I've never attempted to try it. Adding the class and then styling the class is much easier.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Reply     « Reply to Can I apply styles to <a href directly...
 

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.41800 seconds with 12 queries