Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Changing Text on a css hover

Options
  • 11-11-2005 10:41am
    #1
    Closed Accounts Posts: 334 ✭✭


    Hi,


    Is it possible to change the text in a menu item using CSS?
    e.g. If you over over a menu item called 'News', the text will change to 'Nuacht'

    Thanks.


Comments

  • Moderators, Politics Moderators Posts: 39,930 Mod ✭✭✭✭Seth Brundle


    I think JavaScript is needed for this rather than CSS
    http://www.webreference.com/js/column4/text.html
    http://www.codeproject.com/jscript/dcontent.asp
    not sure of the usage of these across different browsers but play around with them


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    I don't understand why you would want to do that, but yes it is possible, manipulation of the innerhtml property or some such, look it up tbh...

    Not sure if the behaviour is supported in IE though, last time (a few years ago now) I messed around with that IE didn't support it :/


  • Closed Accounts Posts: 334 ✭✭WhatsGoingOn


    Baz_ wrote:
    I don't understand why you would want to do that, but yes it is possible, manipulation of the innerhtml property or some such, look it up tbh...

    Not sure if the behaviour is supported in IE though, last time (a few years ago now) I messed around with that IE didn't support it :/

    Thanks, maybe images might be a safer option.
    I'm doing a GAA site, so thought it would look good if the menus were bi-lingual


  • Closed Accounts Posts: 519 ✭✭✭smeggle


    With images it would be easy enough to do in css
    BACKGROUND-IMAGE: url(images3/glbnav_background.gif);

    If you use the css img src similar to what I've quoted then you coupld for a: use nav image 1 'News' and then for 'On Hover in your css it's
    a:hover
    

    so here you would src your img url tp image 2 or 'Naucht'

    This should swap images from News as the background to Naucht.. You'll need your image height, width etc.. but it should work...

    Haven't tried myself though....


  • Registered Users Posts: 771 ✭✭✭whiteshadow


    css separates content from presentation
    so no.. you couldn't change text as that's content.

    you could use an imageswap though?


  • Advertisement
  • Closed Accounts Posts: 334 ✭✭WhatsGoingOn


    css separates content from presentation
    so no.. you couldn't change text as that's content.

    you could use an imageswap though?

    It's ok, got it sorted, that Javascript solution above mentioned by kbannon worked perfectly, Thanks.


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    css separates content from presentation
    so no.. you couldn't change text as that's content.

    you could use an imageswap though?
    you can you know


  • Registered Users Posts: 771 ✭✭✭whiteshadow


    Baz_ wrote:
    you can you know
    really?
    how?


  • Registered Users Posts: 68,317 ✭✭✭✭seamus


    really?
    how?
    CSS has a "content" attribute you can use to insert content into elements.


  • Registered Users Posts: 1,268 ✭✭✭hostyle


    seamus wrote:
    CSS has a "content" attribute you can use to insert content into elements.

    See also IE's support for behaviours that allow you to run limited javascript commands in your CSS.


  • Advertisement
Advertisement