HTML Element Style How to - Create UL with rounded corner








Question

We would like to know how to create UL with rounded corner.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul {<!--from   w w  w .  j a v a2s.c o  m-->
  width: auto;
  background: blue;
  height: 20px;
  -webkit-border-radius: 12px;
  -moz-border-radius: 12px;
  border-radius: 12px;
  list-style: none;
}

ul li {
  float: left;
}

ul li a {
  padding: 0 5px;
  color: #fff;
  text-decoration: none;
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">nav1</a></li>
    <li><a href="#">nav1</a></li>
    <li><a href="#">nav1</a></li>
    <li><a href="#">nav1</a></li>
  </ul>
</body>
</html>

The code above is rendered as follows: