For your two problems :
You can add
overflow:hidden;
to#content
. So your clearfix rule on child will be applied only inside #content, it won't mind anymore your floatting side bar : DEMOMake it simple, trigger layout. Make a search on dealing with floatting element. There's many ways depending on result you look for .
- For the scroll bar, swap to another box-model to include the padding into the 100%; height, Add :
box-sizing:border-box
to#main
. DEMO