Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Using images instead of text in menu tabs?
Is there anyway to use images in the menu tabs instead of text? (Discussions, Categories, Search, etc...)
I want the menu to look 100% identical across all browsers / os's - and to match up with the rest of my site. Preferably with use of 3 different gif's for each menu item (1 each for TabOn, TabOff and TabOff:hover
cheers
0
This discussion has been closed.
Comments
.TabOn { text-indent: -2000em; background: #fff (whatever.gif) no-repeat top center; }
changing it for the hover and off states will give the effect you want.
.TabOn { background: url("bg.gif"); }
not work?
--------edit--------
ok here's the css...
/* list items code*/ #MenuForum { list-style: none; width:990px; background: url(bg_nav.gif) no-repeat; height:40px; padding:20px 0 0 281px; } #MenuForum li { float:left; } /*tab styles*/ /*-----------------------------------------------------------------------------------------*/ .TabOn, .TabOn:link, .TabOn:visited, .TabOn:hover, .TabOff, .TabOff:link, .TabOff:visited, .TabOff:hover { text-decoration: none; text-indent: -4000px; height:17px; display:block; } /*image for each tab*/ .DiscussionsTab{ background:url(nav_discussions.gif) no-repeat; width:99px; } .CategoriesTab{ background:url(nav_categories.gif) no-repeat; width:91px; margin-left:11px; } .SearchTab{ background:url(nav_search.gif) no-repeat; width:63px; margin-left:11px; } .SettingsTab{ background:url(nav_settings.gif) no-repeat; width:73px; margin-left:11px; } .AccountTab{ background:url(nav_account.gif) no-repeat; width:70px; } /*tab on*/ /*-----------------------------------------------------------------------------------------*/ .TabOn, .TabOff:hover{ background-position: 0 -17px; }
there is extra code in there that you wont need but it should be easy to adjust to your needs.
note that you must have both link states in the same image. for example:
and then I have restricted the height to show only one half on the image at any one time. on hover you move the background image position to reveal the other part of the image. thus your roll over, very fast as well because it doesn't need to load a second image on roll over.
to make the text not show i have used text-indent: -4000px; this works because i've used float:left; rather than display:inline; - display inline doesn't work well in older browsers so i always stay clear of it anyway.
now unfortuntely in old versions of ie on mac, and possibly win i can't remember, using text-indent will also move the background image off of the screen. unfortunatley there's not much that can be done here without altering the html...
if i was to write the html for the nav i would stick a span inside the a tag and then use display:none; on the span with the background image still on the a tag. but it's up to you whether you want to change the html before the templating system is out or whether you're not fussed about the older browsers.
hope that helps.
you can see the style here
There are some days I just want to smack the w3 consortium upside the head.
EDIT: Apparently, it would just be .DiscussionTab.TabOn{}.
You have been spared. This time.