HTML Element Style How to - Make UL/LI autogrow








Question

We would like to know how to make UL/LI autogrow.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
li {<!--   w w  w .  ja  v  a2  s  . co m-->
  float: left;
  width: 100px;
  border: 1px solid black;
}
</style>
</head>
<body>
  <ul>
    <li>Test</li>
    <li>Test Test Test Test</li>
  </ul>
</body>
</html>

The code above is rendered as follows: