Submit Your Article Forum Rules

Results 1 to 6 of 6

Thread: css rollovers using background position

  1. #1
    Senior Member
    Join Date
    Nov 2004
    Posts
    510

    css rollovers using background position

    I am trying to design a menu and for items that are NOT links i want an arrow, for those that are links i want no arrow - see http://www.m-science.com/products/ - the product list on the left hand side - this is in a table based layout but i would like to do this as a css list menu.

    so far i have this as my css:
    #menu {
    width: 138px;
    font-size:10px;
    margin:0 3px 0 0;
    padding:0;
    }
    #menu ul {
    list-style-type:none;
    text-align:left;
    margin:0;
    padding:0 3px 0 0;
    color:#6899CC;
    }
    #menu ul li {
    background: url(arrow.gif) 3px 5px no-repeat;
    font-weight:bold;
    padding:5px 5px 7px 12px;
    margin:3px 0 0 3px;
    border-bottom:1px dashed #828282;
    border-top:0px;
    }
    #menu li a:link,
    #menu li a:active,
    #menu li a:visited,
    #menu li a:hover {
    background-position: -200px -200px;
    text-decoration:none;
    color:#a4a4a4;
    font-weight:normal;
    }
    #menu li a:hover{
    color:#a4a4a4;
    text-decoration:underline;
    }


    and heres my html:
    [size=9]<div id="menu">
    <ul>[*]Introduction[*]SMS Online[*]SMS Server[*]SMS Groupware[*]SMS for Developers[*]SMS for Web Service[*]SMS Email Gateway[*]SMS Automation Server[/list]
    </div>
    [/small]

    the arrows display all the time they are not disappearing when a list item is a link - i have looked up tutorial after tutorial online and cannot find how to make this work so any advice is truly appreciated!
    tahnk you

  2. #2
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    CSS:
    Code:
    #menu {
    	width: 138px;
    	font-size:10px;
    	margin:0 3px 0 0;
    	padding:0;
    }
    #menu ul {
    	list-style-type:none;
    	text-align:left;
    	margin:0;
    	padding:0 3px 0 0;
    	color:#6899CC;
    }
    #menu ul li {
    	font-weight:bold;
    	padding:5px 5px 7px 0;
    	margin:3px 0 0 3px;
    	border-bottom:1px dashed #828282;
    	border-top:0px;
    	display: block;
    }
    #menu ul li b {
    	background-image: url(arrow.gif);
    	background-position: 3px 50%;
    	background-repeat: no-repeat;
    	padding-left: 12px;
    }
    #menu li a:link,
    #menu li a:active,
    #menu li a:visited,
    #menu li a:hover {
    	text-decoration:none;
    	color:#a4a4a4;
    	font-weight:normal;
    	padding-left: 12px;
    }
    #menu li a:hover{
    	color:#a4a4a4;
    	text-decoration:underline;
    }
    HTML:
    Code:
    <div id="menu">
    	<ul>
    		[*]Introduction
    		[*]SMS Online
    		[*]SMS Server
    		[*]SMS Groupware
    		[*]SMS for Developers
    		[*]SMS for Web Service
    		[*]SMS Email Gateway
    		[*]SMS Automation Server
    	[/list]
    </div>

  3. #3
    Senior Member
    Join Date
    Nov 2004
    Posts
    510
    thanks speed that has done the trick....whilst you are on hand being so helpful though...
    with any menu options that are longer than one line, the second line sits right to the left and doesn't have the same padding - is there a way to overcome this?

    thank you once again

  4. #4
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    Change the CSS to:
    Code:
    #menu li a:link,
    #menu li a:active,
    #menu li a:visited,
    #menu li a:hover {
    	text-decoration:none;
    	color:#a4a4a4;
    	font-weight:normal;
    	padding-left: 12px;
    	display: block;
    }
    The display: block is the addition.

  5. #5
    Senior Member
    Join Date
    Nov 2004
    Posts
    510
    you're a star thank you so much!

  6. #6
    WebProWorld MVP
    Join Date
    Aug 2003
    Posts
    1,039
    Glad to help.

Similar Threads

  1. Background position bottom not working properly in firefox!
    By wickywills in forum Web Programming Discussion Forum
    Replies: 6
    Last Post: 12-06-2009, 10:58 AM
  2. From position 12 to position 500, all because the Site Description changed!!
    By fulleffect in forum Search Engine Optimization Forum
    Replies: 9
    Last Post: 11-04-2008, 10:13 AM
  3. Image Rollovers
    By Lamer980 in forum Graphics & Design Discussion Forum
    Replies: 7
    Last Post: 08-09-2008, 12:30 AM
  4. Remote Rollovers
    By pete200677 in forum Graphics & Design Discussion Forum
    Replies: 4
    Last Post: 06-08-2006, 05:19 PM
  5. Rollovers
    By WPW_Feedbot in forum Graphics & Design Discussion Forum
    Replies: 0
    Last Post: 12-28-2004, 03:31 AM

Posting Permissions

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