How to Center Align Unordered List inside Div Using CSS

In this tutorial, learn how to center align unordered list inside div using HTML and CSS. The short answer is: use CSS text-align property to align list center position in HTML.

The center alignment places the list in the middle of the div element horizontally. You can use this to center align your website menus horizontally.

Let’s find out the method with the example given below.

How to Center Align Unordered List inside Div Using CSS

The above example contains the unordered list items that display as inline using the CSS property display: inline. After that, it placed inside the <div> element and applies the CSS property text-align: center to the div that align the list to the center position as given below:

Output

  • Home
  • About
  • Gallery
  • Contact

The above example shows the center-aligned HTML list that looks like the menu items placed horizontally center position. You can unordered list or the ordered list items and use the above method to move them to the middle of the <div>.

You May Also Like to Read