Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2007
    Posts
    88
    Tokens
    0

    Default Bit of div/css help please

    I'm doing my very first div / css layout and I've come to a bit of a problem.

    How do I get the 'home' div under the 'navigation' div.
    Heres the source code to help you
    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>
    <title>MyTropica - SNAPPY SLOGAN</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <style type="text/css">
    <!--
    body {
      background-image: url(images/layout/backtest.png);
      text-align: center;
      margin: 0px;
    }
    body, td, tr, table, th, div, span {
    	font-family: Arial;
    	font-size: 11px;
    	color: #000000;
    	font-weight: normal;
    }
    #top {
    	background-image: url(images/layout/top_bar.png);
    	background-repeat: repeat-x;
    	font-weight: bold;
    	height: 17px;
    	padding-left: 5px;
    	padding-right: 5px;
    	padding-top: 3px;
    	text-align: left;
    	border-bottom: 1px dotted #A6A6A6;
    }
    #bottom {
    	background-image: url(images/layout/top_bar.png);
    	background-repeat: repeat-x;
    	font-weight: bold;
    	height: 17px;
    	width: 98%;
    	padding-left: 1%;
    	padding-right: 1%;
    	padding-top: 3px;
    	text-align: left;
    	border-top: 1px dotted #A6A6A6;
    	position: absolute;
    	bottom: 0px;
    	left: 0px;
    	float: left;
    }
    .spacer {
    	height: 10px;
    }
    #main {
    	width: 800px;
    	margin-top: auto;
    	text-align: center;
    }
    #navtop {
    	background-image: url(images/layout/top_bar.png);
    	background-repeat: repeat-x;
    	width: 195px;
    	padding-right: 5px;
    	font-weight: bold;
    	padding-top: 3px;
    	border: 1px dotted #A6A6A6;
    	height: 17px;
    	float: left;
    }
    #contenttop {
    	background-image: url(images/layout/top_bar.png);
    	background-repeat: repeat-x;
    	width: 545px;
    	padding-right: 5px;
    	font-weight: bold;
    	padding-top: 3px;
    	border: 1px dotted #A6A6A6;
    	height: 17px;
    	float: right;
    }
    #advert {
    	background-image: url(images/layout/grey.png);
    	width: 400px;
    	border: 1px dotted #A6A6A6;
    	height: 125px;
    }
    .navbutton {
    	background-image: url(images/layout/grey.png);
    	width: 195px;
    	padding-right: 5px;
    	font-weight: bold;
    	padding-top: 3px;
    	border-left: 1px dotted #A6A6A6;
    	border-right: 1px dotted #A6A6A6;
    	border-bottom: 1px dotted #A6A6A6;
    	height: 17px;
    	float: left;
    	margin: auto;
    }
    -->
    </style>
    </head>
    <body>
    <div id="top">Hello and welcome to MyTropica.net</div>
    
    <div class="spacer"></div>
    
    <center>
    <div id="main">
    
    <center>
    <div id="advert">Some type of rotating advert here</div>
    </center>
    <div class="spacer"></div>
    
    <div id="navtop">Navigation</div>
    <div class="navbutton">Home</div>
    <div id="contenttop">Main Content</div>
    
    <div id="bottom">Copyright MyTropica 2008+</div>
    
    </div>
    </center>
    
    </body>
    </html>

  2. #2
    Join Date
    Dec 2006
    Posts
    7,601
    Tokens
    95

    Latest Awards:

    Default

    youve used class"navbutton" for the home, change it to navtop

    does that work?

  3. #3
    Join Date
    Nov 2007
    Posts
    88
    Tokens
    0

    Default

    The home is meant to be navbutton, navtop is the bit that says 'navigation' thanks for replying though

    edit:
    i can make 2 buttons go under each other, if i remove the 'float: left;' out of 'navbutton' however this makes them in the center, not to the left.
    I'll keep trying

    edit 2:
    by using another div to put the whole of the navigation in, I have made it work.
    Last edited by SmileUK; 10-02-2008 at 10:56 PM.

  4. #4
    Join Date
    Dec 2006
    Posts
    7,601
    Tokens
    95

    Latest Awards:

    Default

    ok try change the nav button class to float: left

Posting Permissions

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