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 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2006
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSS Nav/Content Question

    Hi,

    Trying to have a fixed width navigation menu of say 150px on the left side, then a content div that fills up the rest of the screen regardless of the resolution.

    This is what I have below, but cannot figure out how to get the #content div to fill the rest of the screen.

    Can this be done in CSS?

    Thanks,

    RishiD

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    	<title>Blah</title>
             <style type="text/css">
             #wrapper {
    	width: 100%;
    	margin: 10px auto;
              }
    #categories {
    	width:150px;
    	padding:5px 5px;	
    }
    #content {
    	
    	float:left;
    }
    	</style>	
    </head>
    <body>
    <div id="wrapper">
    	<div id="categories">
    		THIS IS THE NAV
    	</div>
    	<div id="content">
    		THIS IS THE MAIN CONTENT
    	</div>
    </div>
    </body>
    </html>

  • #2
    New Coder
    Join Date
    Aug 2005
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure I totally understand what you are looking for but this might help.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>Blah</title>
    <style type="text/css">
    #wrapper {
    	width: 100%;
    	margin: 10px auto;
              }
    #categories {
    	width: 150px;
    	float: left;
    	padding: 5px;	
    }
    #content {
    	margin: 0px 0px 0px 165px;
    	padding: 5px;
    }
    	</style>
    </head>
    <body>
    <div id="wrapper">
      <div id="categories">THIS IS THE NAV </div>
      <div id="content">THIS IS THE MAIN CONTENT</div>
    </div>
    </body>
    </html>

  • #3
    New Coder
    Join Date
    Feb 2006
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yep that is what I thought of as a workaround.

    Thanks

    #categories {
    width: 7em;
    float:left;
    }
    #content {
    margin-left: 7em;
    padding-left:5px;
    }


  •  

    Posting Permissions

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