www.webdeveloper.com
Results 1 to 6 of 6

Thread: [RESOLVED] Tabs shift left when hovering

  1. #1
    Join Date
    Sep 2012
    Posts
    48

    resolved [RESOLVED] Tabs shift left when hovering

    Why does my menu shift left when I hover over any one of them. And my contact tab hover box drops over the edge. Any help would be great.

    Code:
    body, ul, li {
    	font-size:14px; 
    	font-family:Arial, Helvetica, sans-serif;
    	line-height:21px;
    	text-align:left;
    }
    
    #menu {
    	list-style:none;
    	width:740px;
    	margin:30px auto 0px auto;
    	height:43px;
    	padding:0px 10px 0px 20px;
    
    	/* Rounded Corners */
    	
    	-moz-border-radius: 20px;
    	-webkit-border-radius: 10px;
    	border-radius: 30px;
    
    	/* Background color and gradients */
    	
    	background: #014464;
    	background: -moz-linear-gradient(top, #0272a7, #013953);
    	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#0272a7), to(#013953));
    	
    	/* Borders */
    	
    	border: 1px solid #002232;
    
    	-moz-box-shadow:inset 0px 0px 1px #edf9ff;
    	-webkit-box-shadow:inset 0px 0px 1px #edf9ff;
    	box-shadow:inset 0px 0px 1px #edf9ff;
    }
    
    #menu li {
    	float:left;
    	display:block;
    	text-align:center;
    	position:relative;
    	padding: 4px 40px 4px 10px;
    	margin-right:12px;
    	margin-left:22px;
    
    	margin-top:7px;
    	border:none;
    }
    
    #menu li:hover {
    	border: 1px solid #777777;
    	padding: 4px 9px 4px 9px;
    	
    	/* Background color and gradients */
    	
    	background: #F4F4F4;
    	background: -moz-linear-gradient(top, #F4F4F4, #EEEEEE);
    	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F4F4F4), to(#EEEEEE));
    	
    	/* Rounded corners */
    	
    	-moz-border-radius: 5px 5px 0px 0px;
    	-webkit-border-radius: 5px 5px 0px 0px;
    	border-radius: 5px 5px 0px 0px;
    }
    
    #menu li a {
    	font-family:Arial, Helvetica, sans-serif;
    	font-size:14px; 
    	color: #EEEEEE;
    	display:block;
    	outline:0;
    	text-decoration:none;
    	text-shadow: 1px 1px 1px #000;
    }
    
    #menu li:hover a {
    	color:#161616;
    	text-shadow: 1px 1px 1px #ffffff;
    }
    #menu li .drop {
    	padding-right:21px;
    	background:url("img/drop.png") no-repeat right 8px;
    }
    #menu li:hover .drop {
    	background:url("img/drop.png") no-repeat right 7px;
    }
    
    .dropdown_1column, 
    .dropdown_2columns, 
    .dropdown_3columns, 
    .dropdown_4columns,
    .dropdown_5columns {
    	margin:4px auto;
    	float:left;
    	position:absolute;
    	left:-999em; /* Hides the drop down */
    	text-align:left;
    	padding:10px 5px 10px 5px;
    	border:1px solid #777777;
    	border-top:none;
    	
    	/* Gradient background */
    	background:#F4F4F4;
    	background: -moz-linear-gradient(top, #EEEEEE, #BBBBBB);
    	background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#EEEEEE), to(#BBBBBB));
    
    	/* Rounded Corners */
    	-moz-border-radius: 0px 5px 5px 5px;
    	-webkit-border-radius: 0px 5px 5px 5px;
    	border-radius: 0px 5px 5px 5px;
    }
    
    .dropdown_1column {width: 140px;}
    .dropdown_2columns {width: 280px;}
    .dropdown_3columns {width: 420px;}
    .dropdown_4columns {width: 560px;}
    .dropdown_5columns {width: 700px;}
    
    #menu li:hover .dropdown_1column, 
    #menu li:hover .dropdown_2columns, 
    #menu li:hover .dropdown_3columns,
    #menu li:hover .dropdown_4columns,
    #menu li:hover .dropdown_5columns {
    	left:-1px;
    	top:auto;
    }
    
    .col_1,
    .col_2,
    .col_3,
    .col_4,
    .col_5 {
    	display:inline;
    	float: left;
    	position: relative;
    	margin-left: 5px;
    	margin-right: 5px;
    }
    .col_1 {width:130px;}
    .col_2 {width:270px;}
    .col_3 {width:810px;}
    .col_4 {width:550px;}
    .col_5 {width:690px;}
    
    #menu .menu_right {
    	float:right;
    	margin-right:0px;
    }
    #menu li .align_right {
    	/* Rounded Corners */
    	-moz-border-radius: 5px 0px 5px 5px;
        -webkit-border-radius: 5px 0px 5px 5px;
        border-radius: 5px 0px 5px 5px;
    }
    
    #menu li:hover .align_right {
    	left:auto;
    	right:-1px;
    	top:auto;
    }
    
    #menu p, #menu h2, #menu h3, #menu ul li {
    	font-family:Arial, Helvetica, sans-serif;
    	line-height:21px;
    	font-size:12px;
    	text-align:left;
    	text-shadow: 1px 1px 1px #FFFFFF;
    }
    #menu h2 {
    	font-size:21px;
    	font-weight:400;
    	letter-spacing:-1px;
    	margin:7px 0 14px 0;
    	padding-bottom:14px;
    	border-bottom:1px solid #666666;
    }
    #menu h3 {
    	font-size:14px;
    	margin:7px 0 14px 0;
    	padding-bottom:7px;
    	border-bottom:1px solid #888888;
    }
    #menu p {
    	line-height:18px;
    	margin:0 0 10px 0;
    }
    
    #menu li:hover div a {
    	font-size:12px;
    	color:#015b86;
    }
    #menu li:hover div a:hover {
    	color:#029feb;
    }
    
    
    .strong {
    	font-weight:bold;
    }
    .italic {
    	font-style:italic;
    }
    
    .imgshadow { /* Better style on light background */
    	background:#FFFFFF;
    	padding:4px;
    	border:1px solid #777777;
    	margin-top:5px;
    	-moz-box-shadow:0px 0px 5px #666666;
    	-webkit-box-shadow:0px 0px 5px #666666;
    	box-shadow:0px 0px 5px #666666;
    }
    .img_left { /* Image sticks to the left */
    	width:auto;
    	float:left;
    	margin:5px 15px 5px 5px;
    }
    
    #menu li .black_box {
    	background-color:#333333;
    	color: #eeeeee;
    	text-shadow: 1px 1px 1px #000;
    	padding:4px 6px 4px 6px;
    
    	/* Rounded Corners */
    	-moz-border-radius: 5px;
        -webkit-border-radius: 5px;
        border-radius: 5px;
    
    	/* Shadow */
    	-webkit-box-shadow:inset 0 0 3px #000000;
    	-moz-box-shadow:inset 0 0 3px #000000;
    	box-shadow:inset 0 0 3px #000000;
    }
    
    #menu li ul {
    	list-style:none;
    	padding:0;
    	margin:0 0 12px 0;
    }
    #menu li ul li {
    	font-size:12px;
    	line-height:24px;
    	position:relative;
    	text-shadow: 1px 1px 1px #ffffff;
    	padding:0;
    	margin:0;
    	float:none;
    	text-align:left;
    	width:130px;
    }
    #menu li ul li:hover {
    	background:none;
    	border:none;
    	padding:0;
    	margin:0;
    }
    
    #menu li .greybox li {
    	background:#F4F4F4;
    	border:1px solid #bbbbbb;
    	margin:0px 0px 4px 0px;
    	padding:4px 6px 4px 6px;
    	width:116px;
    
    	/* Rounded Corners */
    	-moz-border-radius: 5px;
        -webkit-border-radius: 5px;
        -khtml-border-radius: 5px;
        border-radius: 5px;
    }
    #menu li .greybox li:hover {
    	background:#ffffff;
    	border:1px solid #aaaaaa;
    	padding:4px 6px 4px 6px;
    	margin:0px 0px 4px 0px;
    }
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <link rel="stylesheet" href="menu.css" type="text/css" media="screen" />
    
    <title>Accessible Destinations - Home</title>
    
    
    </head>
    
    <body>
    
    
     <div id="banner" style="text-align: center;"><img src="images/banner3.jpg"  alt=""></div>
    
    
    
    <ul id="menu">
        
        <li><a href="#">Home</a><!-- Begin Home Item -->
        
        
        </li><!-- End Home Item -->
    
        <li><a href="#" class="drop">Destinations</a>
        
        <!-- Begin Destinations Item -->
        
            <div class="dropdown_3columns">
            
            <!-- Begin Destinations container -->
            
                <div class="col_3">
                    <h2>This is a heading title</h2>
                </div>
                
                <div class="col_1">
                
                    <h3>Some Links</h3>
                    <ul>
                        <li><a href="#">ThemeForest</a></li>
                        <li><a href="#">GraphicRiver</a></li>
                        <li><a href="#">ActiveDen</a></li>
                        <li><a href="#">VideoHive</a></li>
                        <li><a href="#">3DOcean</a></li>
                    </ul>   
                     
                </div>
        
                <div class="col_1">
                
                    <h3>Useful Links</h3>
                    <ul>
                        <li><a href="#">NetTuts</a></li>
                        <li><a href="#">VectorTuts</a></li>
                        <li><a href="#">PsdTuts</a></li>
                        <li><a href="#">PhotoTuts</a></li>
                        <li><a href="#">ActiveTuts</a></li>
                    </ul>   
                     
                </div>
        
                <div class="col_1">
                
                    <h3>Other Stuff</h3>
                    <ul>
                        <li><a href="#">FreelanceSwitch</a></li>
                        <li><a href="#">Creattica</a></li>
                        <li><a href="#">WorkAwesome</a></li>
                        <li><a href="#">Mac Apps</a></li>
                        <li><a href="#">Web Apps</a></li>
                    </ul>   
                     
                </div>
        
                <div class="col_1">
                
                    <h3>Misc</h3>
                    <ul>
                        <li><a href="#">Design</a></li>
                        <li><a href="#">Logo</a></li>
                        <li><a href="#">Flash</a></li>
                        <li><a href="#">Illustration</a></li>
                        <li><a href="#">More...</a></li>
                    </ul>   
                     
                </div>
                
            </div>
            <!-- End Destinations container -->
        
        </li>
        <!-- End Destinations Item -->
    
    <li><a href="#">Resources</a><!-- Begin Resources Item -->
    <li><a href="#">Comments</a><!-- Begin Comments Item -->
    <li><a href="#">Contact</a><!-- Begin Contact Item -->
    
    &nbsp;
    &nbsp;
    &nbsp;
    &nbsp;
    
    
    
    
    	
    </body>
    
    </html>

  2. #2
    Join Date
    Mar 2011
    Posts
    1,252
    At a glance, you have different padding settings on #menu li and #menu li:hover which would cause that kind of thing.
    Rick Trethewey
    Rainbo Design

  3. #3
    Join Date
    Sep 2012
    Posts
    48
    I made some adjustments and everything looks even. But the tabs still jerk a little when you hover over them. I wanted o add my changes to this reply. But it doesn't allow me to.

  4. #4
    Join Date
    Oct 2012
    Posts
    1
    Hi, charisma44!
    I've also noticed that you have the border of #menu li set to none while the border of #menu li:hover is 1px solid. That means that the li item expands by 2px each time you hover it.

    You could give the #menu li border of 1px and it shouldn't move on hover.

  5. #5
    Join Date
    Oct 2012
    Posts
    3
    I made some adjustments and everything looks even. But the tabs still jerk a little when you hover over them. I wanted o add my changes to this reply. But it doesn't allow me to.

  6. #6
    Join Date
    Sep 2012
    Posts
    48
    Hello ITZ. What I did was put the boarder to 0px and it stopped shifting. Thanks everyone.

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.14866 seconds
  • Memory Usage 2,932KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (6)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates