Jump to content

Recommended Posts

Posted

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?

Posted

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>

 

Posted
<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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...