Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts

    html css menu issue

    hey there awesome people!!

    i'm having problem on my rollovers to get my menu working?

    the text and image seem to move a few pixels to the left on hover?

    any help would be greatly appreciated...

    http://gandhiproductions.herobo.com/...test/menu.html

    thank you

    Gandhi

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello evilgandhi,
    Do you like it better when you remove that negative margin? See highlighted in red -
    Code:
    nav li a:hover {
    	position:absolute;
    	height:100px;
    	width:100px;
    	margin:-2px;
    	border:2px solid #a3a3a3;
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Maybe more like this?
    Code:
    nav li {
      height: 100px;
      width: 100px;
    	background:#6194aa;
    	float:left;
    	list-style:none;
    	margin-left:5px;
    	
    }
    nav li a {
      height: 90px;
      width: 90px;
    	position:absolute;
      padding: 5px;
    	line-height:165px;
    	text-decoration:none;
    	color:#FFF;
    	background-image:url(image/martani-icons.png);
      border: 2px solid transparent;
      display: block;
    }
    
    nav li a:hover {
      margin: -2px 0 0 -2px;
    	border:2px solid #a3a3a3;
    }
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New Coder
    Join Date
    Aug 2011
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the above code isn't right either........ i don't want any movement....... the only thing that should appear is the 2px border around each box on hover.....

    if you have a hotmail/outlook account login and click the arrow to the right of the outlook logo see the menu and drop from the top..

    that what i what it to look like and function like (with out it dropping down)

    here is a screenshot of said menu

    http://gandhiproductions.herobo.com/...2001.09.45.png

    thank you for help, and the speed of your response

    G

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,667
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    I see what you're wanting. Have a look at it this way -
    Code:
    nav li {
      height: 100px;
      width: 100px;
    	background:#6194aa;
    	float:left;
    	list-style:none;
    	margin-left:5px;
    	
    }
    nav li a {
      height: 86px;
      width: 86px;
    	position:absolute;
      padding: 5px;
    	line-height: 155px;
    	text-decoration:none;
    	color:#FFF;
    	background-image:url(image/martani-icons.png);
      border: 2px solid #fff;
      display: block;
    }
    
    nav li a:hover {border:2px solid #a3a3a3;}
    Here's why that works - See the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #6
    New Coder
    Join Date
    Aug 2011
    Posts
    57
    Thanks
    0
    Thanked 0 Times in 0 Posts
    legend.

    thank very much!!!!

    G


  •  

    Tags for this Thread

    Posting Permissions

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