html - Center a <ul> list -


i've been trying find solution problem, nothing has worked me far. hope help.

i'm trying normal <ul> list center on page. way i've been thinking solve embedding list inside div, , center div using margin: 0 auto;. problem list seems take, default, 100% width of parent. how can adjust actual list width long longest list-item?

here illustration of trying do: enter image description here

or, alternatively (i'm okay either solution):

enter image description here

thanks.

to adjust width longest item add display: inline-block; ul element

jsfiddle


Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

collision detection - C++ library for mesh to mesh intersection: what is available? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -