Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-05-2009, 05:14 PM   PM User | #1
intcon
New Coder

 
Join Date: Mar 2009
Posts: 89
Thanks: 27
Thanked 0 Times in 0 Posts
intcon is an unknown quantity at this point
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
intcon is offline   Reply With Quote
Old 04-05-2009, 05:27 PM   PM User | #2
PitbullMean
Regular Coder

 
Join Date: Oct 2007
Location: Glencoe, Ontario, Canada
Posts: 340
Thanks: 19
Thanked 27 Times in 27 Posts
PitbullMean is an unknown quantity at this point
#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"
__________________
Eric "PitbullMean" Melo
Always Start your layout with*{border:0; margin:0; padding:0;}
Be sure to Thank ALL Users who give assistance.

Last edited by PitbullMean; 04-05-2009 at 05:31 PM..
PitbullMean is offline   Reply With Quote
Users who have thanked PitbullMean for this post:
intcon (04-06-2009)
Old 04-05-2009, 05:29 PM   PM User | #3
abduraooft
Supreme Master coder!

 
abduraooft's Avatar
 
Join Date: Mar 2007
Location: N/A
Posts: 14,678
Thanks: 158
Thanked 2,182 Times in 2,169 Posts
abduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really niceabduraooft is just really nice
Try
Code:
#content .padding{
padding:0 10px;
}
for your second box.

PS: Naming a CSS selector like .padding is not a good practice.
__________________
Quote:
The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)
abduraooft is offline   Reply With Quote
Old 04-05-2009, 05:44 PM   PM User | #4
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
intcon (04-06-2009)
Old 04-05-2009, 05:51 PM   PM User | #5
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
intcon (04-06-2009)
Old 04-05-2009, 06:33 PM   PM User | #6
intcon
New Coder

 
Join Date: Mar 2009
Posts: 89
Thanks: 27
Thanked 0 Times in 0 Posts
intcon is an unknown quantity at this point
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
intcon is offline   Reply With Quote
Old 04-05-2009, 06:37 PM   PM User | #7
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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
Excavator is offline   Reply With Quote
Old 04-05-2009, 06:54 PM   PM User | #8
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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
Excavator is offline   Reply With Quote
Users who have thanked Excavator for this post:
intcon (04-06-2009)
Old 04-05-2009, 11:35 PM   PM User | #9
intcon
New Coder

 
Join Date: Mar 2009
Posts: 89
Thanks: 27
Thanked 0 Times in 0 Posts
intcon is an unknown quantity at this point
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
intcon is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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 On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:47 AM.


Advertisement
Log in to turn off these ads.