Page Widget How to - Create tab with UL








Question

We would like to know how to create tab with UL.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.nav {<!--  w  ww.  j a va 2  s  . co  m-->
  z-index: 99;
  position: relative;
  bottom: -8px;
}

.nav li {
  float: left;
  display: block;
  margin: 0 10px 0 0;
  padding: 0;
}

.nav a {
  display: block;
  background: blue;
  color: #fff;
  text-decoration: none;
  font-size: 11px;
  line-height: 1;
  padding: 7px 20px;
}

.content {
  clear: both;
  padding: 5px 5px 100px 5px;
  border: 1px solid blue;
  background: white;
  z-index: 100;
  position: relative;
}
</style>
</head>
<body>
  <ul class="nav">
    <li><a href="#">Tab 1</a></li>
    <li><a href="#">Tab 2</a></li>
  </ul>
  <div class="content">Hello world.</div>
</body>
</html>

The code above is rendered as follows: