HTML Element Style How to - Create div vertical list with border








Question

We would like to know how to create div vertical list with border.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
<!--from w w  w.j ava  2s  . c o m-->
body {
  padding-top: 20px;
  padding-bottom: 40px;
}

.container {
  width: 420px;
}

.row {
  border: 1px solid;
}

.row+.row {
  border-top: 0;
}
</style>
</head>
<body>
  <div class="container">
    <div class="row heading">
      <div class="col-md-12">Header</div>
    </div>
    <div class="row subheading">
      <div class="col-md-12">Some text</div>
    </div>
    <div class="row footer">
      <div class="col-md-12">Footer</div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: