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 8 of 8
  1. #1
    New Coder
    Join Date
    Nov 2011
    Posts
    15
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Div positioning? (too much white space)

    Hi all thanks for reading i am having a bit of a issue with my collage work there is a large amount of white space to the top right of my images and there is also a bit of unnessacery white space to the top left also but not as much (marked in RED )

    i have been working on this issue for about 3 hours and i am completly stuck sorry if this is a simple question but i am still in my first month of learning html/css

    How site should look



    How it currenlty looks





    Site link

    HTML Code

    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">
    <SCRIPT LANGUAGE="Javascript"><!--
    var isNS = (navigator.appName == "Netscape") ? 1 : 0;
    var EnableRightClick = 0;
    if(isNS) 
    document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
    function mischandler(){
    if(EnableRightClick==1){ return true; }
    else {return false; }
    }
    function mousehandler(e){
    if(EnableRightClick==1){ return true; }
    var myevent = (isNS) ? e : event;
    var eventbutton = (isNS) ? myevent.which : myevent.button;
    if((eventbutton==2)||(eventbutton==3)) return false;
    }
    function keyhandler(e) {
    var myevent = (isNS) ? e : window.event;
    if (myevent.keyCode==96)
    EnableRightClick = 1;
    return;
    }
    document.oncontextmenu = mischandler;
    document.onkeypress = keyhandler;
    document.onmousedown = mousehandler;
    document.onmouseup = mousehandler;
    //-->
    </script> 
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>John Leslie | Garden Design</title>
    <link href="css/garden.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
    h5 {
    	color: #666;
    }
    h2 {
    	font-size: 20px;
    	color: #A89C7B;
    }
    a:active {
    	color: #9C0;
    }
    h3 {
    	color: #999;
    }
    h4 {
    	color: #A89C7B;
    }
    h6 {
    	color: #999;
    }
    h1 {
    	color: #A89C7B;
    }
    </style>
    </head>
    
    <body>
    
    <div class="container">
      <div class="sidebar1"></div>
      <div class="content">
       <div class="img"> <img src="images/home_main-01.jpg" alt="" width="282" height="405" align="left" />
          
          <div class="desc">
          </div>
     </div>
        <div class="img"> <a href="index.html"><img src="images/grdns_country_01.jpg" alt="" width="124" height="122" /></a>
          
          <div class="desc">
         <h4>GARDENS</h4>
         <h5>Click for details</h5>
          </div>
     </div>
     <div class="img"> <a href="index.html"><img src="images/feat_thm_water.jpg" alt="" width="124" height="122" /></a>
       
       <div class="desc">
         <h4>WATER</h4>
         <h5>Click for details</h5>
       </div>
     </div>
     <div class="img"> <a href="index.html"><img src="images/feat_thm_wood.jpg" alt="" width="124" height="122" /></a>
       
       <div class="desc">
         <h4>WOOD</h4>
         <h5>Click for details</h5>
       </div>
     </div>
     <div class="img"> <a href="index.html"><img src="images/feat_thm_general.jpg" alt="" width="124" height="122" /></a>
       
       <div class="desc">
         <h4>GENERAL</h4>
         <h5>Click for details</h5>
       </div>
     </div>
     <div class="maincontent">
       <h2>JOHN LESLIE GARDENS</h2>
       <p>&nbsp;</p>
       <p>A complete redesign of the  clients website.<br />
         Design, creation and  implementation of a website, containing a set of categorised online 'gallery'  sections to showcase the clients past work in designing and constructing water  features, woodwork, </p>
       <p>stonework and completely landscaped gardens.</p>
       <p><br />
         Provide a professional  brochure site with an easy to navigate menu system to help browse through a  very high volume of photographs showing various examples of the clients work.</p>
     </div>
      </div>
      <div class="sidebar2"><br  />
           
          <p><a href="index.html">Home</a></p>
          <p><a href="Site/gallery.html">Gallerys</a></p>
          <p><a href="Site/features.html">Features</a></p>
          <p><a href="Site/about.html">About Us</a></p>
          <p><a href="Site/contact.html">Contact Us</a></p>
       
    </div>
      <div class="footer"> 
      </div>
    </div>
    </body>
    </html>
    CSS Code

    Code:
    @charset "utf-8";
    body {
    	font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
    	padding: 0;
    	color: #666;
    }
    
    ul, ol, dl {
    	padding: 0;
    	margin: 0;
    }
    h1, h2, h3, h4, h5, h6, P {/* Htag padding */
    	margin-top: 0px;
    	padding-right: 15px;
    	padding-left: 15px;
    	color: #999;
    	margin-bottom: 0px;
    	clear: both;
    }
    /* Start of imgage center layout */
     
     div.img
       {
    	margin:2px;
    	/* [disabled]border:1px solid #0000ff; */
    	height:inherit;
    	width:auto;
    	float:left;
    	text-align:center;
       }
     div.img img
       {
    	display:inline;
    	margin:3px;
    	/* [disabled]border:1px solid #ffffff; */
    	width: auto;
    	clear: both;
       }
     div.img a:hover img
       {
    	/* [disabled]border:1px solid #0000ff; */
       }
     div.desc
       {
    	text-align:center;
    	font-weight:normal;
    	width:auto;
    	margin:2px;
    	/* [disabled]clear: both; */
       }
    /* End of imgage center layout */
    
    a:link {
    	color:#FFF;
    	text-decoration: none;
    	cursor: auto;
    	padding-left: 15px;
    }
    
    a:visited {
    	color: #CCC;
    	text-decoration: underline;
    }
    
    a:hover, a:active, a:focus {
    	text-decoration: blink;
    	color: #9C0;
    	font-size: 100%;
    	line-height: inherit;
    	/* [disabled]font-family: Arial, Helvetica, sans-serif; */
    }
    
    .container {
    	width: 80%;
    	max-width: 1260px;
    	min-width: 780px;
    	background: #FFF;
    	margin: 0 auto;
    	overflow: hidden;
    }
    
    .sidebar1 {
    	float: left;
    	width: 20%;
    	height: 700px;
    	background-image: url(../images/left_panel.png);
    	background-repeat: no-repeat;
    }
    
    .content {
    	padding: 0px 0;
    	width: 60%;
    	float: left;
    	color: #666;
    }
    
    .maincontent {
    	clear: both;
    	
    }
    .sidebar2 {
    	float: left;
    	width: 20%;
    	height: 700px;
    	background-image: url(../images/right_panel.png);
    	background-repeat: no-repeat;
    	color: #CCC;
    	font-weight: bold;
    	font-style: italic;
    	/* [disabled]padding-left: 10px; */
    }
    
    .content ul, .content ol {
    	padding: 0 15px 15px 40px;
    }
    .footer {
    	padding: 10px 0;
    	position: relative;/* this gives IE6 hasLayout to properly clear */
    	clear: both; /* this clear property forces the .container to understand where the columns end and contain them */
    	border-color: #BDBDBD;
    	/* [disabled]background-color: #A89C7B; */
    }
    Thank you very much for looking i hope i have provided all the relivent info i know its only a small issue but its extremly frustrating

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    You could try a global reset:

    * {margin: 0; padding: 0; border: 0;}
    Teed

  • #3
    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 again Ani[|]al,
    You have your .sidebars 1 and 2 set at 20% width but their image is a fixed 200px width.

    Try this -
    Code:
    .sidebar1 {
    	float: left;
    	width: 200px;
    	height: 700px;
    	background-image: url(../images/left_panel.png);
    	background-repeat: no-repeat;
    }
    
    .content {
    	padding: 0px 0;
    	width: 60%;
    	float: left;
    	color: #666;
    }
    
    .maincontent {
    	clear: both;
    	
    }
    .sidebar2 {
    	float: left;
    	width: 200px;
    	height: 700px;
    	background-image: url(../images/right_panel.png);
    	background-repeat: no-repeat;
    	color: #CCC;
    	font-weight: bold;
    	font-style: italic;
    	/* [disabled]padding-left: 10px; */
    }




    ...
    OR, you could try a background color that would match the image like this -
    Code:
    .sidebar1 {
    	float: left;
    	width: 20%;
    	height: 700px;
    	background: #a89c7b url(../images/left_panel.png) no-repeat;
    }
    
    .sidebar2 {
    	float: left;
    	width: 20%;
    	height: 700px;
    	background: #a89c7b url(../images/right_panel.png) no-repeat;
    	color: #CCC;
    	font-weight: bold;
    	font-style: italic;
    	/* [disabled]padding-left: 10px; */
    }
    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

  • Users who have thanked Excavator for this post:

    Ani[|]al (11-23-2011)

  • #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
    Some interesting reading for you - http://www.sitepoint.com/dont-disable-right-click/
    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
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Ahh yes, Excavator beat me to it..lol

    I didn't see your page link before, but yes the use of percentages AND pixels and whats causing those gaps.
    Teed

  • #6
    New Coder
    Join Date
    Nov 2011
    Posts
    15
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Excavator to the rescue again thank you so much i will play with those options now

    also sorry about the right click i was just playing about to see how it worked i totaly forgot i uploaded the site with that code sat on the background

    thanks guys i am off to play with the ideas

  • #7
    New Coder
    Join Date
    Nov 2011
    Posts
    15
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Excavator i have tried the 2 options above it does make the document look much cleaner and the white space to the left is perfect however the larger white space to the right side is still as large as it was before

    i am thinking the issue is the div.img but i really have no clue

    i have uploaded my changes to the site link in my first post
    Last edited by Ani[|]al; 11-23-2011 at 08:15 PM.

  • #8
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by Ani[|]al View Post
    Excavator i have tried the 2 options above it does make the document look much cleaner and the white space to the left is perfect however the larger white space to the right side is still as large as it was before

    i am thinking the issue is the div.img but i really have no clue

    i have uploaded my changes to the site link in my first post
    The space you are seeing on the right is what's left after one of the floated images drops.

    err...the space you were seeing.

    I see you've put a 1000px width on .container which is what I was going to suggest next.
    A little less width would close that gap down a bit more... to do that you will need to remove/adjust the following:
    • 2px margin on .img and .desc
    • 15px padding on the anchors
    • 15px left/right padding on h4 and h5
    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


  •  

    Posting Permissions

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