Web Analytics Made Easy -
StatCounter A Little Aligning Question - CodingForum

Announcement

Collapse
No announcement yet.

A Little Aligning Question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new 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
    #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; Apr 5, 2009, 12: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.

    Comment


    • #3
      Try
      Code:
      #content .padding{
      [ICODE]padding:0 10px;[/ICODE]
      }
      for your second box.

      PS: Naming a CSS selector like .padding is not a good practice.
      Digitalocean Cloud Hosting (Referral link - get $10 free credit) Fameco

      Comment


      • #4
        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:[COLOR="Red"] 0[/COLOR] 10px;
        }
        .imginfo {
        margin-[COLOR="Red"]bottom[/COLOR]:1em;
        [COLOR="Red"]overflow: auto;[/COLOR]
        }
        .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 a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

        Comment


        • #5
          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 a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

          Comment


          • #6
            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

            Comment


            • #7
              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 a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

              Comment


              • #8
                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">
                    [COLOR="Red"]<p></p>[/COLOR] <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">
                    [COLOR="Red"]<p></p>[/COLOR] <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">
                    [COLOR="Red"]<p></p>[/COLOR] <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 a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

                Comment


                • #9
                  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

                  Comment

                  Working...
                  X