Posted on Leave a comment

How to center UL with CSS – HTML

Ever wondered how to center a ul with css in a html page ?

<HTML>
<head>

<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>

<div id="center">
<ul>
<li>HTML</li>
<li>CSS</li>
<li>JAVASCRIPT</li>
</ul>
</div>

</body>

</html>
ul li 
{
	display: inline;

}

li
{
	color: black;
	font-weight: bold;
	font-size: 30px;
}
#center
{
	text-align: center;
}

And the result

Capture