Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Changing Text on a css hover

  • 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, Paid Member Posts: 44,020 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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, Registered Users 2 Posts: 771 ✭✭✭whiteshadow


    Baz_ wrote:
    you can you know
    really?
    how?


  • Registered Users, Registered Users 2 Posts: 68,173 ✭✭✭✭seamus


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


  • Registered Users, Registered Users 2 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