changing the style of <a> in text

S

Sharon Lee

I know how to change styles for most attributes such as:

style =\"color: black\"

but how do you change the style for <a> such as the 'link' 'active'
and 'visited'?

I can't find a solution anywhere.

Thanks
 
S

Sharon Lee


Thanks brucie, good reading. However, I want to change the style in
the text, not in the style sheet.

This is how it works: <p class="bluetext" style =\"color: black;\" >
where p has taken the style from the style sheet entry for
'p.bluetext' but then the style has been changed in the text so that
the color is black.

So my question was how to change the features of an <a> the same way.

You can have <a class="bluetext"> which sets the features, now how to
change these settings with "style" for 'active' and 'hover' etc.

Anyway I think I will use the style sheet solution that you have
pointed out might be the most sensible rather than worry about this
now.
 
B

brucie

Thanks brucie, good reading. However, I want to change the style in
the text, not in the style sheet.

you cant stick pseudo elements or classes in the source.
Anyway I think I will use the style sheet solution that you have
pointed out might be the most sensible

very
 
D

David Dorward

Sharon said:
I know how to change styles for most attributes such as:
style =\"color: black\"

What's with the slashes?
but how do you change the style for <a> such as the 'link' 'active'
and 'visited'?

There is no way (except a proposal which AFAIK has gone nowhere and not been
implemented anywhere) of using inline style to match pseudo-classes. You
have to use a seperate style sheet.
 
B

brucie

And that stops you from using it how?

it doesn't stop you using it, you just shouldn't.

if you start wondering away from the "standards" then you may as well
start using <blink>, <marquee> and any other "non-standard" markup that
someone has thought up.
 
S

Sharon Lee

What's with the slashes?

slashes are to escape the quote marks in php, sorry about that.
There is no way (except a proposal which AFAIK has gone nowhere and not been
implemented anywhere) of using inline style to match pseudo-classes. You
have to use a seperate style sheet.

Thanks for the info, it is a bit of a shame because all the other html
elements seem to respond to inline style changes.
 
B

brucie

slashes are to escape the quote marks in php, sorry about that.

use single quotes so you don't have to escape your double quotes.

e.g. echo'style="color:black"';

or double quotes so you don't have to escape your single quotes

e.g. echo"style='color:black'";
 
V

vickie_raven

I know how to change styles for most attributes such as:

style =\"color: black\"

but how do you change the style for <a> such as the 'link' 'active'
and 'visited'?

I can't find a solution anywhere.

Thanks

Sharon

Try placing this code in the head section and see if it works for you
it will change the style of the link visited and link active

<style type="text/css">
<!--

a:link {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 24px;
color: #FF3333;
text-decoration: underline;
background-color: #00FF33;
display: inline;
}
a:visited {
font-family: "Times New Roman", Times, serif;
font-size: 9px;
color: #FFFF33;
text-decoration: line-through;
}
-->
</style>
 
M

Mark Parnell

Try placing this code in the head section and see if it works for you
it will change the style of the link visited and link active

<style type="text/css">
<!--

You don't need an HTML comment here.

And of course, you could always put the style rules in an external
stylesheet, rather than in the head of every page.
a:link {
font-family: Geneva, Arial, Helvetica, sans-serif;
font-size: 24px;

Don't use px - IE users can't resize them. Use %.
color: #FF3333;
text-decoration: underline;
background-color: #00FF33;
display: inline;

display: inline; is unnecessary - text is inline by default.
}
a:visited {
font-family: "Times New Roman", Times, serif;
font-size: 9px;

Ditto on above.
color: #FFFF33;
text-decoration: line-through;

Hmmm. Interesting idea.

Ditto on above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,577
Members
45,054
Latest member
LucyCarper

Latest Threads

Top