HTML Element Style How to - Show Grid in UL Lists








Question

We would like to know how to show Grid in UL Lists.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.container {<!--  ww w  . j  a va 2 s  . c om-->
  border: 1px solid #ff0000;
  width: 580px;
}

.container-inner {
  padding: 30px;
}

.row {
  overflow: hidden;
}

ul {
  margin: 0 0 0 -20px;
  padding: 0;
  overflow: hidden;
}

li {
  width: 160px;
  float: left;
  margin: 0 0 0 20px;
  list-style: none;
}

.inner {
  border: 1px solid #ccc;
  padding: 10px;
}
</style>
</head>
<body>
  <div class="container">
    <div class="container-inner">
      <div class="row">
        <ul>
          <li><div class="inner">Item 1</div></li>
          <li><div class="inner">Item 1</div></li>
          <li><div class="inner">Item 1</div></li>
        </ul>
      </div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: