changing the style of <a> in text

Discussion in 'HTML' started by Sharon Lee, Dec 28, 2003.

  1. Sharon Lee

    Sharon Lee Guest

    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 Lee, Dec 28, 2003
    #1
    1. Advertising

  2. Sharon Lee

    brucie Guest

    brucie, Dec 28, 2003
    #2
    1. Advertising

  3. Sharon Lee

    Sharon Lee Guest

    On Sun, 28 Dec 2003 18:26:31 +1000, brucie
    <> wrote:

    >in post <news:>
    >Sharon Lee said:
    >
    >> how do you change the style for <a> such as the 'link' 'active'
    >> and 'visited'?

    >
    >http://allmyfaqs.com/faq.pl?Links_with_different_colors
    >
    >--


    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.
    Sharon Lee, Dec 28, 2003
    #3
  4. Sharon Lee

    brucie Guest

    in post <news:>
    Sharon Lee said:

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


    >>http://allmyfaqs.com/faq.pl?Links_with_different_colors


    > 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

    --
    brucie
    28/December/2003 07:35:07 pm kilo
    brucie, Dec 28, 2003
    #4
  5. Sharon Lee wrote:

    > 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.

    --
    David Dorward <http://dorward.me.uk/>
    David Dorward, Dec 28, 2003
    #5
  6. brucie wrote:

    > in post <news:>
    > Sharon Lee said:
    >
    >>>> how do you change the style for <a> such as the 'link' 'active'
    >>>> and 'visited'?
    >>>
    >>>http://allmyfaqs.com/faq.pl?Links_with_different_colors

    >>
    >> 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.


    Yes you can.

    <a href="http://www.w3.org/"
    style="{color: #900}
    :link {background: #ff0}
    :visited {background: #fff}
    :hover {outline: thin red solid}
    :active {background: #00f}">...</a>

    It's just not supported in any browsers (yet).

    http://www.w3.org/TR/css-style-attr

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
    Toby A Inkster, Dec 29, 2003
    #6
  7. Sharon Lee

    brucie Guest

    in post <news:p>
    Toby A Inkster said:

    >> you cant stick pseudo elements or classes in the source.


    > Yes you can.


    no you cant

    > <a href="http://www.w3.org/"
    > style="{color: #900}
    > :link {background: #ff0}
    > :visited {background: #fff}
    > :hover {outline: thin red solid}
    > :active {background: #00f}">...</a>
    >
    > It's just not supported in any browsers (yet).
    > http://www.w3.org/TR/css-style-attr


    its a working draft

    --
    brucie
    30/December/2003 01:15:14 am kilo
    brucie, Dec 29, 2003
    #7
  8. brucie wrote:

    > in post <news:p>
    > Toby A Inkster said:
    >
    >>> you cant stick pseudo elements or classes in the source.

    >
    >> Yes you can.

    >
    > no you cant
    >
    >> It's just not supported in any browsers (yet).
    >> http://www.w3.org/TR/css-style-attr

    >
    > its a working draft


    And that stops you from using it how?

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?page=132
    Toby A Inkster, Dec 30, 2003
    #8
  9. Sharon Lee

    brucie Guest

    in post <news:p>
    Toby A Inkster said:

    >>> It's just not supported in any browsers (yet).
    >>> http://www.w3.org/TR/css-style-attr


    >> its a working draft


    > 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.

    --
    brucie
    30/December/2003 02:07:18 pm kilo
    brucie, Dec 30, 2003
    #9
  10. Sharon Lee

    Sharon Lee Guest

    On Sun, 28 Dec 2003 10:01:57 +0000, David Dorward <>
    wrote:

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

    >
    >What's with the slashes?


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

    >> 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.
    >


    Thanks for the info, it is a bit of a shame because all the other html
    elements seem to respond to inline style changes.
    Sharon Lee, Jan 3, 2004
    #10
  11. Sharon Lee

    brucie Guest

    in post <news:>
    Sharon Lee said:

    >>> style =\"color: black\"


    >>What's with the slashes?


    > 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'";

    --
    brucie
    03/January/2004 10:38:22 am kilo
    brucie, Jan 3, 2004
    #11
  12. Sharon Lee

    vickie_raven Guest

    On Sun, 28 Dec 2003 08:20:51 GMT, (Sharon Lee)
    wrote:

    >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>
    vickie_raven, Feb 4, 2004
    #12
  13. Sharon Lee

    Mark Parnell Guest

    On Wed, 04 Feb 2004 08:28:54 -0500, vickie_raven
    <> declared in alt.html:
    >
    > 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.

    > </style>


    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    Mark Parnell, Feb 4, 2004
    #13
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard
    Replies:
    3
    Views:
    500
    ghoul-cow
    Dec 22, 2005
  2. Rolf Kemper
    Replies:
    0
    Views:
    375
    Rolf Kemper
    Oct 15, 2004
  3. Aaron Beall
    Replies:
    2
    Views:
    1,804
    Aaron Beall
    Sep 14, 2007
  4. Ken Varn
    Replies:
    0
    Views:
    447
    Ken Varn
    Apr 26, 2004
  5. Perdit
    Replies:
    3
    Views:
    218
    Richard Cornford
    Sep 22, 2003
Loading...

Share This Page