HTML Element Style How to - Show LI horizontal








Question

We would like to know how to show LI horizontal.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#navbar li {<!--from ww  w. j  a  v  a  2s . c  o m-->
  display: inline;
  padding: 0 10px;
}
</style>
</head>
<body>
  <ul id="navbar">
    <li>Adam</li>
    <li>Eve</li>
    <li>Tom</li>
    <li>Jasmine</li>
  </ul>
</body>
</html>

The code above is rendered as follows: