Underlining text, changing colors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henry

    Underlining text, changing colors

    How can I change the text in a link, originally displayed with the
    "text-decoration:none " attribute to display an underline during the
    onMouseOver event, and back to its original (non-underlined) state for
    the onMouseOut? I'm pretty sure that it's of the format

    document.<itemn ame>.attribute = value

    but beyond that I'm not sure, and I can't find enough of a reference to
    let me proceed. I'd also like, as an alternative, to be able to change
    the font color instead of (or in addition to) just changing to underlining.

    I'd appreciate it very much if anyone can provide a bit of code, or can
    point me to some on-line reference that shows this. Thanks!


    Henry
  • Mick White

    #2
    Re: Underlining text, changing colors

    Henry wrote:
    [color=blue]
    > How can I change the text in a link, originally displayed with the
    > "text-decoration:none " attribute to display an underline during the
    > onMouseOver event, and back to its original (non-underlined) state for
    > the onMouseOut?[/color]

    <style type="text/css">
    a:hover {
    text-decoration: underline;
    }
    </style>

    Mick

    Comment

    • Henry Hayden

      #3
      Re: Underlining text, changing colors


      Thanks, Mick, for the speedy reply. I haven't used CSS before (I've had
      some minor exposure to them, and I know that I should be using them...)
      so I have a couple of questions.

      First, does it matter where this snippet is placed on the HTML page? I
      tried it in several locations (just inside the BODY and HTML tags, as
      well as inside a <Table></TABLE>, but no soap.

      Does it matter that the page where I'm trying to implement this is part
      of a frameset? I have a links page (the left-most frame) where I want
      this to be in effect.

      Second- does the page's extension matter? Not only is this page part of
      a frameset, it is also a JSP page. (Aha, the truth comes out!) Could
      this be a factor, as well?

      Certainly these effects are not crucial, but they are, I believe, pretty
      understated and can give the page a more polished look. I'd like to get
      this working, and appreciate your help.


      Henry



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Keith Bowes

        #4
        Re: Underlining text, changing colors

        Mick White wrote:[color=blue]
        > a:hover {
        > text-decoration: underline;
        > }[/color]

        But be warned, modern browsers will also display this effect for <a>s
        with only a "name" or "id" attribute.

        Comment

        • Mick White

          #5
          Re: Underlining text, changing colors

          Henry Hayden wrote:
          [color=blue]
          > Thanks, Mick, for the speedy reply. I haven't used CSS before (I've had
          > some minor exposure to them, and I know that I should be using them...)
          > so I have a couple of questions.
          >
          > First, does it matter where this snippet is placed on the HTML page? I
          > tried it in several locations (just inside the BODY and HTML tags, as
          > well as inside a <Table></TABLE>, but no soap.[/color]

          Inside <head> tags is preferred.[color=blue]
          >
          > Does it matter that the page where I'm trying to implement this is part
          > of a frameset? I have a links page (the left-most frame) where I want
          > this to be in effect.
          >
          > Second- does the page's extension matter? Not only is this page part of
          > a frameset, it is also a JSP page. (Aha, the truth comes out!) Could
          > this be a factor, as well?[/color]
          This should not matter[color=blue]
          >
          > Certainly these effects are not crucial, but they are, I believe, pretty
          > understated and can give the page a more polished look. I'd like to get
          > this working, and appreciate your help.[/color]

          Take a look:
          Checkout the full domain details of Mickweb.com. Click Buy Now to instantly start the transaction or Make an offer to the seller!


          Mick[color=blue]
          >
          >
          > Henry
          >
          >
          >
          > *** Sent via Developersdex http://www.developersdex.com ***
          > Don't just participate in USENET...get rewarded for it![/color]

          Comment

          • Henry Hayden

            #6
            Re: Underlining text, changing colors

            Thanks again!

            I found, with the help of your last hint, what the problem was. In each
            link, I had the following:

            style: text-decoration: none

            So... it was always going to be just that... none.
            However, using the following:

            <style type="text/css">
            a{
            text-decoration: none;
            }
            a:hover {
            text-decoration: underline;
            }
            </style>

            works just fine. Thanks again!

            Henry


            *** Sent via Developersdex http://www.developersdex.com ***
            Don't just participate in USENET...get rewarded for it!

            Comment

            • Thomas 'PointedEars' Lahn

              #7
              Re: Underlining text, changing colors

              Keith Bowes wrote:
              [color=blue]
              > Mick White wrote:[color=green]
              >> a:hover {
              >> text-decoration: underline;
              >> }[/color]
              >
              > But be warned, modern browsers will also display this effect for <a>s
              > with only a "name" or "id" attribute.[/color]

              Which is why you want to use

              a:link:hover, a:visited:hover {
              ...
              }

              and the like. F'up2 comp.infosystem s.www.authoring.stylesheets.


              PointedEars

              Comment

              Working...