HTML Element Style How to - Remove text decoration and list style to create menu








Question

We would like to know how to remove text decoration and list style to create menu.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
li:focus {<!--from  w w  w  .  ja v  a  2s  .co m-->
  outline: 0;
}

ul {
  list-style-type: none;
}

ul a {
  color: #000;
  text-decoration: none;
}

li {
  float: left;
  width: 150px;
  margin: 0px 10px 0px 0px;
  background: lightgrey;
  text-align: center;
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">Save</a></li>
    <li><a href="#">Blog</a></li>
    <li><a href="#">Funding Sources</a></li>
    <li><a href="#">Users</a></li>
  </ul>
</body>
</html>

The code above is rendered as follows: