www.webdeveloper.com
Results 1 to 3 of 3

Thread: Menu problem with repetition of image.

  1. #1
    Join Date
    Sep 2006
    Posts
    20

    Menu problem with repetition of image.

    Hi,
    Iv got a problem on this test page - http://80.244.186.152/mobilechoiceUK/
    can anyone tell me why the hover menus repeats the image as I do not want this to happen. I need it to function like this -http://www.mobilechoiceuk.com/Home

    Here is the css code ------------------------------------------------------
    HTML Code:
    .mainmenu {
    	BACKGROUND: url(bg.gif) no-repeat 0px 0px; WIDTH: 100%
    }
    .mainmenu UL {
    	LIST-STYLE-TYPE: none
    }
    .mainmenu LI {
    	PADDING-RIGHT: 2px; PADDING-LEFT: 0px; Z-INDEX: 100; BACKGROUND: url(divider.gif) no-repeat 100% 0px; FLOAT: left; PADDING-BOTTOM: 0px; PADDING-TOP: 0px; POSITION: relative
    }
    .mainmenu TABLE {
    	Z-INDEX: 80; LEFT: 0px; POSITION: absolute; TOP: 32px
    }
    .mainmenu A {
    	DISPLAY: block; FONT-WEIGHT: bold; FONT-SIZE: 0.7em; COLOR: #000; HEIGHT: 32px
    }
    .mainmenu LI.item1 A {
    	BACKGROUND: url(item1.gif) no-repeat 0px 0px; WIDTH: 59px
    }
    .mainmenu LI.item2 A {
    	BACKGROUND: url(item2.gif) no-repeat 0px 0px; WIDTH: 58px
    }
    .mainmenu LI.item3 A {
    	BACKGROUND: url(item3.gif) no-repeat 0px 0px; WIDTH: 76px
    }
    .mainmenu LI.item4 A {
    	BACKGROUND: url(item4.gif) no-repeat 0px 0px; WIDTH: 70px
    }
    .mainmenu LI.item5 A {
    	BACKGROUND: url(item5.gif) no-repeat 0px 0px; WIDTH: 60px
    }
    .mainmenu LI.item6 A {
    	BACKGROUND: url(item6.gif) no-repeat 0px 0px; WIDTH: 112px
    }
    .mainmenu LI.item7 A {
    	BACKGROUND: url(item7.gif) no-repeat 0px 0px; WIDTH: 45px
    }
    .mainmenu LI.item8 A {
    	BACKGROUND: url(item8.gif) no-repeat 0px 0px; WIDTH: 85px
    }
    .mainmenu LI.item9 A {
    	BACKGROUND: url(item9.gif) no-repeat 0px 0px; WIDTH: 65px
    }
    .mainmenu LI.item10 A {
    	BACKGROUND: url(item10.gif) no-repeat 0px 0px; WIDTH: 85px
    }
    .mainmenu LI.act A {
    	BACKGROUND-POSITION: 0px -32px
    }
    .mainmenu LI A:hover {
    	BACKGROUND-POSITION: 0px -32px
    }
    .mainmenu UL UL {
    	PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND: url(child.gif) no-repeat 0px 100%; VISIBILITY: hidden; PADDING-BOTTOM: 5px; WIDTH: 200px; PADDING-TOP: 4px; POSITION: absolute
    }
    .mainmenu UL LI:hover UL {
    	VISIBILITY: visible
    }
    .mainmenu UL A:hover UL {
    	VISIBILITY: visible
    }
    .mainmenu UL UL LI {
    	PADDING-RIGHT: 0px! important; DISPLAY: inline; PADDING-LEFT: 0px! important; BACKGROUND: #f0f0f0 ; PADDING-BOTTOM: 0px! important; MARGIN: 0px 0px 0px 4px; WIDTH: 192px; PADDING-TOP: 0px! important
    }
    .mainmenu UL UL LI A {
    	PADDING-RIGHT: 10px; PADDING-LEFT: 10px; BACKGROUND: none transparent scroll repeat 0% 0%; FLOAT: none; PADDING-BOTTOM: 5px; WIDTH: auto! important; PADDING-TOP: 5px; HEIGHT: auto! important
    }
    .mainmenu UL UL LI A:hover {
    	BACKGROUND: #d8d8d8; TEXT-DECORATION: none
    }
    .mainmenu LI.search {
    	PADDING-RIGHT: 10px; PADDING-LEFT: 0px; BACKGROUND: none transparent scroll repeat 0% 0%; FLOAT: right; PADDING-BOTTOM: 0px; PADDING-TOP: 5px
    }
    .mainmenu LI.search INPUT {
    	VERTICAL-ALIGN: middle
    }
    .mainmenu LI.search SELECT {
    	VERTICAL-ALIGN: middle
    }
    .mainmenu LI.search INPUT.txt {
    	WIDTH: 92px
    }
    .mainmenu LI.search SELECT {
    	WIDTH: 92px
    }
    .mainmenu LI.search SELECT {
    	MARGIN: 0px 6px 0px 4px
    
    Here is the page code:----------------------------------------------------
    
    <!-- MAINMENU START -->
    <DIV class=mainmenu >
    <FORM action="" method=post>
    <UL>
      <LI class=item1><A title=Home href="http://www.mobilechoiceuk.com/Home"><SPAN 
      class=hidden>Home</SPAN></A></LI>
      <LI class=item2><A title=News 
      href="http://www.mobilechoiceuk.com/Latest-News"><SPAN 
    class=hidden>News</SPAN><!--[if IE 7]><! --></A><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
        <UL>
        <LI><A href="http://www.mobilechoiceuk.com/Latest-News">Latest news</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Phone-news">Phone news</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Operator-news">Operator 
        news</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Tariff-news">Tariff news</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Accessory-news">Accessory 
        news</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Content-news">Content 
        news</A></LI></UL><!--[if lte IE 6]></td></tr></table></a><![endif]--></LI>
      <LI class=item3><A title=Reviews 
      href="http://www.mobilechoiceuk.com/Reviews"><SPAN class=hidden>Reviews</SPAN><!--[if IE 7]><! --></A><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
      <UL>
        <LI><A href="http://www.mobilechoiceuk.com/Phone-Reviews">Phones</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Accessories">Accessories</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Games">Games</A></LI></UL><!--[if lte IE 6]></td></tr></table></a><![endif]--></LI>
      <LI class=item4><A title=Phones 
      href="http://www.mobilechoiceuk.com/Phones"><SPAN class=hidden>Phones</SPAN><!--[if IE 7]><! -->
      </A>
        <!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
        <UL>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=Nokia">Nokia</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=Samsung">Samsung</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=Motorola">Motorola</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=Sony+Ericsson">Sony 
        Ericsson</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=LG">LG</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=Apple">Apple</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=BlackBerry">BlackBerry</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones?company_name=HTC">HTC</A></LI>
        <LI><A 
    href="http://www.mobilechoiceuk.com/Phones/?company_name=3">3</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Alcatel">Alcatel</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=E-Ten">E-Ten</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Fly+Mobile">Fly 
        Mobile</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=HP">HP</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=MWG">MWG</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=O2">O2</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Palm">Palm</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Sagem">Sagem</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Sennheiser">Sennheiser</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Sharp">Sharp</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=T-Mobile">T-Mobile</A></LI>
        <LI><A 
        href="http://www.mobilechoiceuk.com/Phones/?company_name=Toshiba">Toshiba</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Comparison-tool">Compare 
        Phones</A></LI></UL><!--[if lte IE 6]></td></tr></table></a><![endif]--></LI>
      <LI class=item5><A title=Deals 
      href="http://www.mobilechoiceuk.com/Deals"><SPAN class=hidden>Deals</SPAN><!--[if IE 7]><! -->
      </A>
        <!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
      <UL>
        <LI><A href="http://www.mobilechoiceuk.com/Most-popular-deals">Most popular 
        deals</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Editors-deal-of-the-day">Editor's 
        phone of the day</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Top-deals">Top deals of the 
        week</A></LI>
        <LI><A href="http://www.mobilechoiceuk.com/Deals">See all deals</A></LI></UL><!--[if lte IE 6]></td></tr></table></a><![endif]--></LI>
      <LI class=item6><A title="The magazine" 
      href="http://www.mobilechoiceuk.com/The-magazine"><SPAN class=hidden>The 
      magazine</SPAN></A></LI>
      
      <LI class=item7><A title=Win href="http://www.mobilechoiceuk.com/Win"><SPAN 
      class=hidden>Win</SPAN><!--[if IE 7]><! --></A><!--<![endif]--><!--[if lte IE 6]><table><tr><td><![endif]-->
      <UL>
        <LI><A href="http://www.mobilechoiceuk.com/Win-Terms">Terms &amp; 
        Conditions</A></LI></UL><!--[if lte IE 6]></td></tr></table></a><![endif]--></LI>
      <LI class=item8><A title=Glossary 
      href="http://www.mobilechoiceuk.com/Glossary"><SPAN 
      class=hidden>Glossary</SPAN></A> 
      
    <!--li class="search"><label for="search_txt"><input type="text" name="" id="search_txt" class="txt" /></label><label for="search_select"><select name="" id="search_select"><option selected="selected">All</option></select></label><input type="image" src="assets/images/mainmenu/btn.gif" alt="Search" /></li>--></LI>
    </UL>
    <DIV class=clear></DIV></FORM></DIV><!-- MAINMENU END -->

    Any help appreciated, thank you.
    Last edited by WebJoel; 04-10-2008 at 07:18 PM.

  2. #2
    Join Date
    Mar 2006
    Location
    Newcastle NSW Australia
    Posts
    4,033
    This is due to specificy - the rule .mainmenu LI.item1 A for example is more specific than the general .mainmenu UL UL LI A due to the class name and will over-ride it. The fix here would be to move the top level class names from the <li>s (which contain the submenus) to the <a>s
    Code:
    <LI><A title=Home href="http://www.mobilechoiceuk.com/Home" class="item1">
    and alter the css accordingly
    Code:
    .mainmenu a.item1 {
    	BACKGROUND: url(item1.gif) no-repeat 0px 0px; WIDTH: 59px
    }

  3. #3
    Join Date
    Sep 2006
    Posts
    20
    Thanks a million Centauri that worked great!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles