Div collapse after float css

Total Post:341


 2290  View(s)
Rate this:
Hi every one

I have a div called NAV and inside of NAV I have an UL with 5 li which I float to the left, the li's that is but when I do that the NAV collapses. I know this because I put a border around NAV to see if it collapses and it does.

This is my code


<div id="nav">
        <ul id="ullistNavi">
            <li><a href="#">Home</a></li>
            <li><a href="#">About Us</a></li>
            <li><a href="#">Contact Us></a></li>
            <li><a href="#">Download</a></li>
            <li><a href="#">Service</a></li>
<style type="text/css">
        #nav #ulListNavi a
            float: left;
Thanks in advance
  1. Re: Div collapse after float css

    Hi Ankit Singh

    you can try this

    Add any overflow value other than visible to your container:

    div#nav { overflow:auto; }
    Then add width to restore the width

    div#nav { width: 100%; overflow:auto; }


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.