Equal placement of list items horizontally from left edge to right edge

I wanted to place <li> elements which I used in a horizontal menu to be distributed evenly across the full width of the parent element <ul>.  I used to float my elements from left and add margins for the space in between the each element or I used to display:inline-block;  <li> elements and give text-align:center; to the parent <ul>. 

But again it places the items in middle, this was not I was looking for I wanted to distribute the items in complete width form left edge to the right edge.

Following is the css you can use to simply arrange the items from left to the right edge with equal spacing.

ul{ display:block; clear:both; width:70%; display: flex; justify-content: space-between; padding:0; }


display:flex; and justify-content:space-between will do the magic for you.

Author: Jaydhar Chowdhary

I’m a web designer and front-end web developer with over ten years of professional experience in the design industry. I specialize in creating custom web sites for small businesses – focusing primarily on custom WordPress theme design and development. Other streams like graphic designing, logo designing, package designing and other branding related solutions you can find here.