How to force div element to keep its contents inside container
I making css menu. for this I am using ul. When I make li float left then all lis gets outside of the ul. I mean the height of ul become zero. How can I make li display inside ul after giving float left. 

One way to do is to make a div tag with some common class and add clear: both to it in css but I do not want this. I need better solution. Help please
How to force div element to keep its contents inside container
===

I making css menu. for this I am using ul. When I make li float left then all lis gets outside of the ul. I mean the height of ul become zero. How can I make li display inside ul after giving float left. 

One way to do is to make a div tag with some common class and add clear: both to it in css but I do not want this. I need better solution. Help please