Results 1 to 6 of 6

Thread: Text Rollover and Link Rollover help

  1. #1
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Text Rollover and Link Rollover help

    I am designing a website with a bear/classic horror movie theme and there are a couple things that I would like to do to make it different and unique.

    First thing is, when the mouse rolls over some text, I'd like it to turn from gray to red.

    Second thing is, when the mouse rolls over a link, I want it to look like a bear has slashed over it. Simply put I want a graphic to appear over or at least behind the text when my mouse cursor is over it.

    Any help with either of these things would be grand!

    Thank you
    West

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The first can be achieved like this:
    HTML Code:
    <!-- In the head: -->
    <style type="text/css">
    .red2grey {
    color: grey;
    }
    .red2grey:hover {
    color: red;
    }
    </style>
    HTML Code:
    <!-- In the body: -->
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. <span class="red2grey">Pellentesque urna.</span> Nulla facilisi...
    For the background image, try:
    HTML Code:
    <style type="text/css">
    a:hover {
    background-image: url('bearslash.png');
    }
    </style>
    Note that I'm not sure if this will work.
    Are we talking about an inline link or a navmenu where the link is in its own block-level element?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    It's an inline link...and as far as the text hover goes...I couldn't get it to work

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I do beg your pardon... apparently IE doesn't support :hover except on <a>. Try this:
    HTML Code:
    <span style="color:gray;" onmouseover="this.style.color='red';" onmouseout="this.style.color='gray';">MONKEYS!!!</span>
    For the slash, this works (at least for Firefox):
    HTML Code:
    <span onmouseover="this.style.backgroundImage='url(\'bearslash.png\')';" onmouseout="this.style.backgroundImage='none';">MONKEYS!!!</span>
    Last edited by Twey; 08-03-2005 at 07:56 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Aug 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hey! That first one worked great! The second one didn't work in IE but I'm sure I can figure something out, you've definitely helped alot! Thank you!

    West.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    This works:
    Code:
    <p>Hello there, <a href="blah.htm" onmouseover="this.innerHTML='<a href=\'blah.htm\'><img align=\'absmiddle\' src=\'bearslash.png\'/></a>';" onmouseout="this.innerHTML='bear';">bear</a> fans!</p>
    Make sure the image is more or less the same size as the text, or odd things happen when onmouseout is called as soon as onmouseover happens.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •