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 9 of 9
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    89
    Thanks
    27
    Thanked 0 Times in 0 Posts

    A Little Aligning Question

    Morning all...

    Just a little aligning question - i have a 3 column layout, columns 2 and 3 sit a little below column 1....is this a float problem or a margin problem? I appreciate your help! lots!

    web page

    CSS

    carrie

  • #2
    Regular Coder
    Join Date
    Oct 2007
    Location
    Glencoe, Ontario, Canada
    Posts
    340
    Thanks
    19
    Thanked 27 Times in 27 Posts
    #content .padding {
    padding: 10px;
    }

    get rid of that and u should be fine. Cause everything is inline properly its just your 10px padding is making it look messed up.


    or do this

    Code:
    <div id="content"> 
    <h2>what is your ART? </h2>		
                      <div class="padding"> 
    		    <p>yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda 								yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda yadda 							yadda yadda yadda yadda </p> 
    		  </div> 
        </div>
    Put ur H2 tags above the padding class.

    You also have a div id that doesnt have any attributes. "container"
    Last edited by PitbullMean; 04-05-2009 at 05:31 PM.
    Eric "PitbullMean" Melo
    Always Start your layout with*{border:0; margin:0; padding:0;}
    Be sure to Thank ALL Users who give assistance.

  • Users who have thanked PitbullMean for this post:

    intcon (04-06-2009)

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,849
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Try
    Code:
    #content .padding{
    padding:0 10px;
    }
    for your second box.

    PS: Naming a CSS selector like .padding is not a good practice.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #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 intcon,
    You might want to have that 10px on the sides so you can easily get rid of it on the top, since that's where the problem is.
    Try this instead -
    Code:
    #content .padding {
    	padding: 0 10px;
    }
    .imginfo {
    margin-bottom:1em;
    overflow: auto;
    }
    .imginfo img {float:left;margin-right:1em;margin-bottom: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:

    intcon (04-06-2009)

  • #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
    That use of overflow:auto; is clearing your floats. Have a look at this page for a description of what's happening -http://www.quirksmode.org/css/clearing.html

    Your #container is another div that's not cleared. To demonstrate, put a background color on it like this -
    Code:
    #container {
    background: #f00;
    }
    No red background shows up.
    It does show up when you clear the floats like this -
    Code:
    #container {
    overflow: auto;
    background: #f00;
    }
    But... since you don't style #container in your CSS and it's not enclosing anything, maybe you can just get rid of it. Have a look at this page on divitis.
    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:

    intcon (04-06-2009)

  • #6
    New Coder
    Join Date
    Mar 2009
    Posts
    89
    Thanks
    27
    Thanked 0 Times in 0 Posts
    thanksk for the quick responses! wow!
    if i take out the padding rule altogether, all 3 columns line up correctly (didn't know you shouldn't use .padding - I got it from a tutorial somewhere out there!)
    if i change the img info tho, excavator, my 3rd column then drops back down so the text isn't even with the top of the photo...i guess i don't see the reason why that happens with the code you sent! (yes, I am clueless, and i admit it)
    the container i also learned on a CSS tutorial and it's supposed to just be a placeholder for the 3 columns...i swear that's what the tutorial said! of course then i added in some of my own *clever* touches and probably trashed what i originally started out with....if i remove container, the 3 columns won't just spread out all over the place? or do i just need to close it (reading the article on divitis!)

    carrie

  • #7
    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 intcon View Post
    the container i also learned on a CSS tutorial and it's supposed to just be a placeholder for the 3 columns...i swear that's what the tutorial said! of course then i added in some of my own *clever* touches and probably trashed what i originally started out with....if i remove container, the 3 columns won't just spread out all over the place? or do i just need to close it (reading the article on divitis!)

    carrie
    Your floated columns are already contained by #wrapper.
    A really simple rule of thumb, if you don't have style a div it's not needed.
    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

  • #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 intcon View Post
    if i change the img info tho, excavator, my 3rd column then drops back down so the text isn't even with the top of the photo...i guess i don't see the reason why that happens with the code you sent!
    carrie
    Try the same thing with .imginfo that we did with #container. Add a background color to the code the way it is now-
    Code:
    .imginfo {float:none;clear:both;margin-top:1em;background: #00f;}
    That's a blue background and it only contains the unfloated text. If you were to remove the img you would see it goes the full width of the div.


    Now clear the floats and see what it does. I also remove float:none; (no such thing) and swap the top margin for bottom instead -
    Code:
    .imginfo {
    margin-bottom:1em;
    background: #00f;
    overflow: auto;
    }
    The .imginfo now expands to contain the floated image, including the 10px bottom margin you have on .imginfo img


    -----------------

    Now the text is off, like you said. The div is correct now though, so we can style the text to go where we want.
    To do that we need to edit the markup. If you delete the bits in red the text moves up -
    Code:
     </div>
        </div>
        <div id="side-b"> <div class="imginfo"><img src="images/boy.jpg" height="83" width="100">
        <h2>book now</h2>Text  Text Text Text Text Text Text Text Text Text Text Text <p></p>
    	</div>
    
    	<div class="imginfo">
        <img src="images/boy.jpg" height="83" width="100">
        <p></p> <h2>feature</h2>
          Text  Text Text Text Text Text Text Text Text Text Text Text <p></p>
    	</div>
    
    	<div class="imginfo">
       <img src="images/boy.jpg" height="83" width="100">
        <p></p> <h2>experience</h2>
        Text  Text Text Text Text Text Text Text Text Text Text Text <p></p>
    	</div>
    	
    	<div class="imginfo">
       <img src="images/boy.jpg" height="83" width="100">
        <p></p> <h2>purchase gift</h2>Text  Text Text Text Text Text Text Text Text Text Text Text <p></p>
    	</div>
    	 </div>
      </div>
      <div id="footer"> 
        <div class="right"><span class="footer">
    Does that help?
    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:

    intcon (04-06-2009)

  • #9
    New Coder
    Join Date
    Mar 2009
    Posts
    89
    Thanks
    27
    Thanked 0 Times in 0 Posts
    ok..i see...the blue background helps!

    did dreamweaver add in that <p></p>? i didn't do it! swear!

    sorry it took so long to answer back, blizzard here keeps cutting the electricity out! darnit!

    thanks for the info!

    carrie


  •  

    Posting Permissions

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