How to align center a list with the bullets? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to align center a list with the bullets?

I tried to make a list aligned to the center. but the bullet still in the left, not following to the the center too. https://code.sololearn.com/W6Srlqb1ygv5/#html

21st Aug 2019, 6:45 AM
Adi Pratama
Adi Pratama - avatar
7 Answers
+ 5
ul { margin:auto; max-width:10px; } https://code.sololearn.com/WS2aZhww2MqD/?ref=app Do not use align attribute, it's deprecated.
21st Aug 2019, 7:09 AM
Calviղ
Calviղ - avatar
+ 3
So, the coder need to use margin to set the bullets distance?
21st Aug 2019, 7:12 AM
Adi Pratama
Adi Pratama - avatar
+ 3
I should use width selector, however i cannot predict the ul width, so i use max-width, make sure max-width is smaller than the ul width (small number) so css itself would know how to adjust the actual width. width is the width of ul, you can set background-color to see the difference by adjusting the width.
21st Aug 2019, 7:20 AM
Calviղ
Calviղ - avatar
+ 2
ul { display: flex; flex-direction: column; align-items: center; }
21st Aug 2019, 6:54 AM
Ray
+ 2
Is it true that Width inside your code is the distance from the center not from the left?
21st Aug 2019, 7:15 AM
Adi Pratama
Adi Pratama - avatar
+ 2
Use margin: auto; or flexbox as Sauron demonstrated
21st Aug 2019, 7:15 AM
Calviղ
Calviղ - avatar
+ 2
or just ul{ display:flex; justify-content:center; }
21st Aug 2019, 8:26 AM
Logomonic Learning
Logomonic Learning - avatar