Mario17503 Posted October 3, 2020 Share Posted October 3, 2020 How can I center a list? If I use the attribute style="text-align: center;", I get something like that: • Coffee • Tea • Milk But points don't get centered. Can you help me? Link to comment Share on other sites More sharing options...
JMRKER Posted October 5, 2020 Share Posted October 5, 2020 What does your code look like? This works as expected for me. <!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=yes"/> <title> Test Page </title> <!-- From: https://w3schools.invisionzone.com/topic/62126-how-to-center-a-list/ --> <style> ul { text-align: center; } </style> </head><body> <ul> <li> Coffee </li> <li> Tea </li> <li> Milk </li> </ul> </body></html> Link to comment Share on other sites More sharing options...
Sherin Posted October 8, 2020 Share Posted October 8, 2020 <html> <head></head> <style> ul { display: table; margin : 0 auto; } </style> <body> <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> </body> </html> I think this code is help for you Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now