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 to the CF scene
    Join Date
    Feb 2013
    Location
    Rihcmond,VA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Getting a Fixed width for Site using CSS coding.

    Hello All, I've been working this site for a couple of months. I been able to teach myself for a in the last few months but now I'm stuck.

    I'm trying to get this site to stay at fixed size the navigation menu moves around when the browser window is changed.

    I originally used a

    <div/> and wrap command but those didn't work for some reason.

    does any one have a solution?

    [URL="http://www.chasingturner.com"]

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    How about zooming the background along with text resize? Try setting a height:6.3em; to #masthead.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Aug 2012
    Location
    New Zealand
    Posts
    52
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Try sticking a container around your nav menu usiong this code

    Code:
    menu-container {
       width: px;
        margin: 0 auto;
    }

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello CTCODE,
    When your screen closes down to where the combined width of #top and #botmenu are greater, you will see floatdrop with #botmenu. A big part of the reason that happens so soon is #botmenu gets it's width from 815px wide #submenu. I think that is a little divitis there, what exactly is #submenu doing for you?

    Try getting rid of #submenu, setting a reasonable width on #botmenu and a min-width on #masthead.
    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

  • #5
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Change your markup like this -
    Code:
    <div id="masthead"><!-- masthead begin -->
    
    	<div id="top"> 
    		<h1 class="logo"><a href="http://www.chasingturner.com/" title="CHASING TURNER"><img src="http://www.chasingturner.com/wp-content/themes/Shuttershot/images/logo-01.png"></a></h1>
    	</div>
    <!--deleted #botmenu and #submenu-->
    <ul id="menu-main-menu" class="sfmenu sf-js-enabled sf-shadow"><li id="menu-item-17" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-17"><a href="http://www.chasingturner.com/about//">About</a></li>
    <li id="menu-item-107" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-107"><a href="http://blog.chasingturner.com">Blog</a></li>
    <li id="menu-item-18" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-18"><a class="sf-with-ul" href="http://www.chasingturner.com/portfolio/">Portfolio<span class="sf-sub-indicator"> »</span></a>
    <ul style="display: none; visibility: hidden;" class="sub-menu">
    	<li id="menu-item-20" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-20"><a href="http://www.chasingturner.com/design//">Design</a></li>
    	<li id="menu-item-21" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-21"><a href="http://www.chasingturner.com/illustration/">Illustration</a></li>
    	<li id="menu-item-22" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-22"><a href="http://www.chasingturner.com/photography1/">Photography</a></li>
    </ul>
    </li>
    <li id="menu-item-19" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-19"><a href="http://www.chasingturner.com/contact//">Contact</a></li>
    </ul>  <!--</div>	</div> delete these too-->
    	
    </div><!--end masthead-->
    and some CSS
    Code:
    #masthead {
        background: url("images/top.png") repeat scroll 0 0 transparent;
        height: 80px;
        left: 0 !important;
        min-width: 900px; /*that's what 400px wide #top and 500px wide ul#menu-main-menu fit in*/
        position: fixed;
        top: 30px;
        width: 100%;
        z-index: 200;
    }
    /*Page menu*/
    	
    /* #botmenu{
    	height:40px;
    	margin:15px 0px 0px 0px;
    	font-family:BebasNeueRegular,Arial, verdana,Century gothic, sans-serif;		
    	float:right;
    	}
    	
    #submenu {
    	margin: 0px 0px ;
    	width:815px;
    	padding:0px 0px;
    	}*/
    	
    ul#menu-main-menu {
    	width: 500px;
    	float: left;
    	list-style: none;
    	margin: 0;
    	padding: 0 0px;
    	}
    	
    ul#menu-main-menu li {
    	float: left;
    	list-style: none;
    	margin: 0;
    	padding: 0;
    	color: #ccc;
    	text-shadow:1px 1px 0px #000;
    	font-size: 30px;
    
    	}
    	
    ul#menu-main-menu li a {
    	color: #ccc;
    	display: block;
        margin: 0;
    	padding: 12px 10px 12px 10px;
    	text-decoration: none;
    	position: relative;
    	text-shadow:1px 1px 0px #000;
    	}
    
    ul#menu-main-menu li a:hover, 
    ul#menu-main-menu li a:active, 
    ul#menu-main-menu .current_page_item a  {
    	color: #fff;
    	text-shadow:1px 1px 0px #000;
    
    	}
    	
    ul#menu-main-menu li a.sf-with-ul {
    	padding-right: 10px;
    	}	
    	
    
    	
    ul#menu-main-menu li li a, 
    ul#menu-main-menu li li a:link, 
    ul#menu-main-menu li li a:visited {
    
    	font-size: 14px;
    	color: #aaa;
    	text-shadow:none;
    	width: 148px; 
    	margin: 0;
    	padding: 0px 10px;
    	line-height:35px;
    	border-bottom:1px solid #222;
    	border-top:1px solid #111;
    	border-left:1px solid #111;
    	border-right:1px solid #222;
    	text-transform: none;
    	position: relative;
    	background:#151515;
    	}
    	
    ul#menu-main-menu ul ul li:first-child{
    	border-top:none;
    
    }
    
    ul#menu-main-menu ul ul li:last-child{
    	border-bottom:none;
    
    }	
    	
    ul#menu-main-menu li li:last-child{
    	border-bottom:none;
    }
    		
    ul#menu-main-menu li li a:hover, 
    ul#menu-main-menu li li a:active {
    	background:#070707;
    	color: #fff; 
    	}
    
    
    ul#menu-main-menu li ul {
    	z-index: 9999;
    	position: absolute;
    	left: -999em;
    	height: auto;
    	width: 170px;
    	margin: 5px 0px;
    	padding: 5px 5px;
    	background:#000;
    	border-radius: 3px;
    	-moz-border-radius: 3px;
    	-webkit-border-radius: 3px;
    	}
    
    ul#menu-main-menu li ul a { 
    	width: 150px;
    	}
    
    ul#menu-main-menu li ul a:hover, 
    ul#menu-main-menu li ul a:active { 
    	}
    
    ul#menu-main-menu li ul ul {
    	margin: -41px 0 0 179px;
    	}
    
    ul#menu-main-menu li:hover ul ul, 
    ul#menu-main-menu li:hover ul ul ul, 
    ul#menu-main-menu li.sfHover ul ul, 
    ul#menu-main-menu li.sfHover ul ul ul {
    	left: -999em;
    	}
    
    ul#menu-main-menu li:hover ul, 
    ul#menu-main-menu li li:hover ul, 
    ul#menu-main-menu li li li:hover ul, 
    ul#menu-main-menu li.sfHover ul,
    ul#menu-main-menu li li.sfHover ul, 
    ul#menu-main-menu li li li.sfHover ul {
    	left: auto;
    	}
    
    ul#menu-main-menu li:hover, 
    ul#menu-main-menu li.sfHover { 
    	position: static;
    	}
    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 to the CF scene
    Join Date
    Feb 2013
    Location
    Rihcmond,VA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you all for the suggestions!

    Excavator thank you for info! I had no idea what divitis was before.

    I took your suggestion and rearranged the code. I had mutiple #submenus in the code because at the time i couldn't figure out out to link the visuals of the site with the site functions.

    that being said. I did change the mark up and it did, in fact, lock the menu but the font and position had changed. I discovered that i needed to locks the first set of code place and changed the resulting mark up

    PHP Code:
     #botmenu{
        
    height:40px;
        
    margin:0px 0px 0px 0px;
        
    font-family:BebasNeueRegular,Arialverdana,Century gothicsans-serif;        
        
    float:right;
        [
    COLOR="Blue"]position:fixed;
        
    top:40px;
        
    right:15px;
        
    left400px;[/COLOR]
    }
        
    #submenu {
        
    margin0px 0px ;
        
    width:900px;
        
    padding:0px 0px;
        
    }
        
        
    [
    COLOR="Red"]ul#menu-main-menu[/COLOR] {
        
    width900px;
        
    floatleft;
        list-
    stylenone;
        
    margin0px;
        
    padding0 0px;
        }
        
    [
    COLOR="Red"]ul#menu-main-menu li[/COLOR] {
        
    floatleft;
        list-
    stylenone;
        
    margin0;
        
    padding0;
        
    color#ccc;
        
    text-shadow:1px 1px 0px #000;
        
    font-size35px;

        }
        [
    COLOR="Red"]
    ul#menu-main-menu li [/COLOR]a {
        
    color#ccc;
        
    displayblock;
        
    margin0;
        
    padding12px 10px 12px 10px;
        
    text-decorationnone;
        
    positionrelative;
        
    text-shadow:1px 1px 0px #000;
        
    }

    [
    COLOR="Red"]ul#menu-main-menu li a:hover, 
    ul#menu-main-menu li a:active, 
    ul#menu-main-menu .current_page_item a[/COLOR]  {
        
    color#fff;
        
    text-shadow:1px 1px 0px #000;

        
    }
        [
    COLOR="Red"]
    ul#menu-main-menu li [/COLOR]a.sf-with-ul {
        
    padding-right10px;
        }    
        

        
    [
    COLOR="Red"]ul#menu-main-menu li li a, 
    ul#menu-main-menu li li a:link, 
    ul#menu-main-menu li li a:visited[/COLOR] {

        
    font-size18px;
        
    color#aaa;
        
    text-shadow:none;
        
    width148px
        
    margin0;
        
    padding0px 10px;
        
    line-height:35px;
        
    border-bottom:1px solid #222;
        
    border-top:1px solid #111;
        
    border-left:1px solid #111;
        
    border-right:1px solid #222;
        
    text-transformnone;
        
    positionrelative;
        
    background:#151515;
        
    }
        
    [
    COLOR="Red"]ul#menu-main-menu ul ul li[/COLOR]:first-child{
        
    border-top:none;

    }

    [
    COLOR="Red"]ul#menu-main-menu ul ul li[/COLOR]:last-child{
        
    border-bottom:none;

    }    
        
    [
    COLOR="Red"]ul#menu-main-menu li li[/COLOR]:last-child{
        
    border-bottom:none;
    }
            
    [
    COLOR="Red"]ul#menu-main-menu li li a:hover, 
    ul#menu-main-menu li li a:active[/COLOR] {
        
    background:#070707;
        
    color#fff; 
        
    }

    [
    COLOR="Red"]
    ul#menu-main-menu li ul[/COLOR] {
        
    z-index9999;
        
    positionabsolute;
        
    left: -999em;
        
    heightauto;
        
    width170px;
        
    margin5px 0px;
        
    padding5px 5px;
        
    background:#000;
        
    border-radius3px;
        -
    moz-border-radius3px;
        -
    webkit-border-radius3px;
        }

    [
    COLOR="Red"]ul#menu-main-menu li ul[/COLOR] a { 
        
    width150px;
        }
    [
    COLOR="Red"]
    ul#menu-main-menu li ul a[/COLOR]:hover, 
    [COLOR="Red"]ul#menu-main-menu li ul a[/COLOR]:active { 
        
    }

    [
    COLOR="Red"]ul#menu-main-menu li ul ul[/COLOR] {
        
    margin: -41px 0 0 179px;
        }

    [
    COLOR="Red"]ul#menu-main-menu li:hover ul ul, 
    ul#menu-main-menu li:hover ul ul ul, 
    ul#menu-main-menu li.sfHover ul ul, 
    ul#menu-main-menu li.sfHover ul ul ul[/COLOR] {
        
    left: -999em;
        }
    [
    COLOR="Red"]
    ul#menu-main-menu li:hover ul, 
    ul#menu-main-menu li li:hover ul, 
    ul#menu-main-menu li li li:hover ul, 
    ul#menu-main-menu li.sfHover ul,
    ul#menu-main-menu li li.sfHover ul, 
    ul#menu-main-menu li li li.sfHover ul [/COLOR]{
        
    leftauto;
        }

    ul#menu-main-menu li:hover, 
    ul#menu-main-menu li.sfHover { 
        
    position: static;
        } 
    thanks again for all your help!


  •  

    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
    •