1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

a:hover not working

Discussion in 'CSS' started by FunkyFresh, Jul 18, 2010.

  1. #1
    I havent done css/html in awhile but I just started doing it again to keep it fresh. I finished the whole coding of the layout but the navbar hover still doesnt work. It would be much appreciated if someone can help me out.

    HTML code
     
            <div class="nav_left"></div>
     	<div id="navigation">
               <ul id="menu">
                 <li class="nav_split"> <a href="#">Home </a></li>              
                 <li class="nav_split"> <a href="#">Properties</a></li>   
                 <li class="nav_split"> <a href="#">Sublets</a></li>   
                 <li class="nav_split"> <a href="#">Landlords</a></li>   
                 <li class="nav_split"> <a href="#"> Resources</a></li>   
                 <li class="nav_split"> <a href="#">Contact Us</a></li>   
         	   </ul>
            </div>
    	<div class="nav_right"></div>
            <br class="clear" />
    Code (markup):
    CSS code
    /*Navigation Menu*/
    .nav_left {
    	background:transparent url(../images/nav_left.gif) no-repeat top left;
    	height:42px;
    	width:4px;
    	float:left;
    }
    .nav_right {
    	background:transparent url(../images/nav_right.gif) no-repeat top right;
    	height:42px;
    	width:4px;
    	float:right;
    }
    #navigation {
    	background:url(../images/nav_bg.gif) repeat-x;
    	width:1098px;
    	color: #FFF;
    	font-size:15px;
    	font-weight:bold;
    	list-style-type:none;
    	height:42px;
    	float:left;
    	position:relative;
    }
    
    #menu li{
    	float: left;
    	padding: 11px 0 0 0;
    	height:42px;
    }
    #menu li a{
    	color: #FFF;
    	text-decoration:none;
    	font-size:15px;
    	font-weight:bold;
    	margin: 0px 30px 0 30px;	
    }
    #menu li a:hover {
    	background: url (../images/hover_bg.gif) repeat-x;
    	text-decoration: underline;	
    	height: 42px;
    }
    .nav_split{
    	background: url(../images/nav_div.gif) no-repeat top right;
    }
    Code (markup):
    the hover doesnt show the image, the underline is the only that works. I am boggled as I have looked at other similar examples that work great.
     
    FunkyFresh, Jul 18, 2010 IP
  2. bhuthecoder

    bhuthecoder Member

    Messages:
    245
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    43
    #2
    remove spaces between "url" and "(../images/hover_bg.gif)"

    background: url (../images/hover_bg.gif) repeat-x;
    
    Code (markup):
     
    bhuthecoder, Jul 18, 2010 IP
  3. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #3
    The 'a' element is natively inline, therefor height does not apply. That may not affect your issue, but except for IE≤7, all browsers will ignore the height property.

    You may declare a {display: block;} if you want height.

    cheers,

    gary
     
    kk5st, Jul 19, 2010 IP
  4. ekiemtien

    ekiemtien Peon

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Space between "url" and the var following makes the browser cannot understand.
     
    ekiemtien, Jul 19, 2010 IP
  5. FunkyFresh

    FunkyFresh Peon

    Messages:
    499
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yea that space after the url did the fix of displaying the hover. However that only shows the hover image directly behind the text and doesnt fill the box. Anymore help would be really appreciated

    [​IMG]
     
    FunkyFresh, Jul 20, 2010 IP
  6. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #6
    Did you not read my comment?
     
    kk5st, Jul 20, 2010 IP
  7. FunkyFresh

    FunkyFresh Peon

    Messages:
    499
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #7
    yea I saw it and tried it out but it didnt do anything different :(

    EDIT: I missed the part where you said it should be in the 'a' not the 'a:hover' part. That did fix it tho. One last thing, not important if I dont get it but im looking for perfection lol, the hover now is in the middle like its supposed to but it covers the vertical divider on the right hand side of it.

    Not sure if its solveable but I thought someone might know the trick
     
    Last edited: Jul 21, 2010
    FunkyFresh, Jul 21, 2010 IP
  8. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #8
    Show me your exact coding.
     
    kk5st, Jul 21, 2010 IP
  9. FunkyFresh

    FunkyFresh Peon

    Messages:
    499
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    oops I was editing when you posted.

    EDIT: Picture included [​IMG]
     
    Last edited: Jul 21, 2010
    FunkyFresh, Jul 21, 2010 IP
  10. adiranbe

    adiranbe Peon

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    the site very nice.
     
    adiranbe, Jul 22, 2010 IP
  11. FunkyFresh

    FunkyFresh Peon

    Messages:
    499
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #11
    thank you!
     
    FunkyFresh, Jul 24, 2010 IP
  12. xsabrina.chic

    xsabrina.chic Peon

    Messages:
    131
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #12
    My suggestion is, you need to include what kind of tag you are trying to make a style. I am talking about the ul.
    Removing the url(../images/nav_left.gif) is okay too.

    Try this CSS code:

    /*Navigation Menu*/
    #navigation {
    background: url(images/nav_bg.gif) repeat-x;
    width: 1098px;
    color: #FFF;
    font-size: 15px;
    font-weight: bold;
    list-style-type: none;
    height: 42px;
    float: left;
    position: relative;
    }

    ul#menu li{
    float: left;
    padding: 11px 0 0 0;
    height:42px;
    }
    ul#menu li a{
    color: #FFF;
    text-decoration: none;
    font-size: 15px;
    font-weight:bold;
    margin: 0px 30px 0 30px;
    }
    ul#menu li a:hover {
    background: url (images/hover_bg.gif) repeat-x;
    text-decoration: underline;
    height: 42px;
    }
    ul#menu li.nav_split{
    background: url(images/nav_div.gif) no-repeat top right;
    }
     
    xsabrina.chic, Jul 25, 2010 IP