tags:

views:

27

answers:

2

Hello all. I have a frame which is 760px wide. I then have a div called main inside that which is 750px wide and has padding of 5px.

.main {
width:750px;
background-color:#FFF;
border-style:solid;
border-width:thin;
padding:5px;
margin-bottom:10px;

}

I then have a div inside that called latest which i want 3 side by side.

.latest {
width:240px;
padding:5px;

}

If I put float:left on the latest div, it ends up with them being outside of the main.

<div class="main">
    <div class="latest">
        asdasdas
    </div>

    <div class="latest">
        asdasdas
    </div>

    <div class="latest">
        asdasdas
    </div>
</div>

The code i use to put it all together. I cant think of anything else. Thanks for reading, hope you can help!

+1  A: 
.latest {
    width:240px;
    padding:5px;
    float: left;
}

something to read http://css.maxdesign.com.au/floatutorial/

Read this, http://css.maxdesign.com.au/floatutorial/clear.htm

This will probably solve your problem

add this in your main div

<div class="clear"></div>

and add this in your style

.clear {
clear: both;
}
Wai Wong
In my question, i wrote that if i put float:left, the three latest divs end up outside the main div.
Luke
I am not sure how you mean outside, could you make a screenshot?
Wai Wong
I could do a screenshot, host it and link here?
Luke
http://img706.imageshack.us/img706/8162/probc.jpg
Luke
Edited the answer
Wai Wong
I already have this clear in my css! I will try that then!
Luke
Still didnt work, thanks for the time though.
Luke
A: 

Add overflow: auto to the .main div.

More explanation here: http://gtwebdev.com/workshop/floats/enclosing-floats.php

Anthony
And this is the answer! Cheers bud.I will read that link to understand this attribute more, never used it before!
Luke