...

View Full Version : A Little Aligning Question



intcon
04-05-2009, 05:14 PM
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 (http://www.monarchcottages.com/evans/test9/)

CSS (http://www.monarchcottages.com/evans/test9/evans.css)

carrie

PitbullMean
04-05-2009, 05:27 PM
#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



<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"

abduraooft
04-05-2009, 05:29 PM
Try

#content .padding{
padding:0 10px;
} for your second box.

PS: Naming a CSS selector like .padding is not a good practice.

Excavator
04-05-2009, 05:44 PM
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 -

#content .padding {
padding: 0 10px;
}
.imginfo {
margin-bottom:1em;
overflow: auto;
}
.imginfo img {float:left;margin-right:1em;margin-bottom:10px;}

Excavator
04-05-2009, 05:51 PM
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 -

#container {
background: #f00;
}
No red background shows up.
It does show up when you clear the floats like this -

#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. (http://csscreator.com/?q=divitis)

intcon
04-05-2009, 06:33 PM
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

Excavator
04-05-2009, 06:37 PM
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.

Excavator
04-05-2009, 06:54 PM
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-
.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 -

.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 -
</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?

intcon
04-05-2009, 11:35 PM
ok..i see...the blue background helps!

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

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

thanks for the info!

carrie



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum