www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > CSS

    CSS Discussion and technical support relating to Cascading Style Sheets.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 12-31-2006, 11:04 PM
    problema problema is offline
    Registered User
     
    Join Date: Jan 2006
    Posts: 23
    Unhappy PLZ help with positioning...

    Ok, I understand that this issue has been overwhelmingly covered already, but I have been browsing the forum for hours now and just can't seem to fix my problem.

    Thing is, I centered a div (container) and the high-child div (banner) works fine, but the to bottom ones (left and right) keep floating away from the parent-div's width.

    I am really new to all this and any help would be fully apreciated.

    The .css file:
    Code:
    body {
    	cursor:default;
    	margin: 0;
    	text-align: center;
    }
    
    #container {
    
    	position: relative;	
    	width: 810px;
    	margin: 0 auto;
    	border-spacing: 0px 0px;
    	right: auto;
    	left: auto;
    	clear: left;
    	padding: 0;
    }
    
    #banner {
    	width: 800px;
    	height: 310px;
    	margin: 0;
    	border-color: #999999;
    	color: #ffffff;
    	font: 8pt 'Lucida Grande', LucidaGrande, Lucida, Helvetica, Arial, sans-serif;
    	padding-top: 0px;
    	padding-bottom: 0px;
    	text-align: left;
    }
    
    #left {
    	width: 400px;
    	margin: 0;
    	padding: 0;
    	float: left;
    }
    
    #right {
    	margin: 0;
    	padding: 0 0 0 0px;
    	border-left: dashed #666666 2px;
    	float: right;
    	width: 200px;
    }
    The html code:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    
    <title>:eveRlasT .//</title>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    
    <link href="stylish.css" rel="stylesheet" title="stylish.css" type="text/css" />
    
    </head>
    
    <body>
    <div class="container">
    
    <div class="banner"><img src="interface/banners/random.php"></div>
    
    <div id="left">lteste</div>
    
    <div id="right">rteste</div>
    
    </div>
    
    </body>
    </html>
    I know it's pretty clean right now, and I hope it helps you help me! ...
    Reply With Quote
      #2  
    Old 12-31-2006, 11:17 PM
    bathurst_guy's Avatar
    bathurst_guy bathurst_guy is offline
    Super Moderator
     
    Join Date: Apr 2005
    Location: Bathurst, NSW, Australia
    Posts: 3,350
    first, class is referenced in the stylesheet as . (period) and id as # (hash)
    therefore change your stylesheet (or html) to reflect this. ie:
    <div id="container"> is referenced in the CSS as #container
    <div class="container"> is referenced in the CSS as .container
    __________________
    The answer to all these questions is Google.
    Give your thread a useful title | Webdeveloper.com Acceptable Use Policy
    Something wrong with your code? Validate first! |

    No Australian Net Censorship! The Australian government is wanting to follow in China's footsteps and "provide" nationwide Internet censorship, don't let them!
    Reply With Quote
      #3  
    Old 12-31-2006, 11:24 PM
    ray326's Avatar
    ray326 ray326 is offline
    Got Link?
     
    Join Date: Nov 2003
    Location: Jerryville, Tejas
    Posts: 11,741
    Well the first two divs should have ids, not classes.
    __________________
    Help Save Ana

    Why use Web Standards: Zeldman
    How (new): Castro
    How (experienced): Cederholm
    If you can only get one book and you're already HTML savvy then this is it:
    stylin' with CSS: A Designer's Guide
    Charles Wyke-Smith
    New Riders


    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
    Reply With Quote
      #4  
    Old 12-31-2006, 11:39 PM
    problema problema is offline
    Registered User
     
    Join Date: Jan 2006
    Posts: 23
    Holy crap! That was effective.

    Geez, I'ma have some trouble til I actually learn this thing...

    Well, thanks a lot, I am very thankful for your help (though it made me look stupid ) and I shall now proceed to further headaches.

    PS: it is comforting to know that I can get real help online, I'll try not to post stupid questions in the future...
    Reply With Quote
      #5  
    Old 12-31-2006, 11:46 PM
    bathurst_guy's Avatar
    bathurst_guy bathurst_guy is offline
    Super Moderator
     
    Join Date: Apr 2005
    Location: Bathurst, NSW, Australia
    Posts: 3,350
    No problem. While we are on the issue of 'id vs class' maybe you would like to know the differences between them and why you would use one over the other.
    http://www.w3.org/TR/html401/struct/...tml#adef-class
    http://www.webdeveloper.com/forum/sh...d.php?t=109986
    http://www.webdeveloper.com/forum/sh...ad.php?t=85247
    __________________
    The answer to all these questions is Google.
    Give your thread a useful title | Webdeveloper.com Acceptable Use Policy
    Something wrong with your code? Validate first! |

    No Australian Net Censorship! The Australian government is wanting to follow in China's footsteps and "provide" nationwide Internet censorship, don't let them!
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:16 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.