Page Widget How to - Add Borders only between elements








Question

We would like to know how to add Borders only between elements.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
* {<!--from ww w .j a  v  a  2  s  .  c  o  m-->
  margin: 0;
  padding: 0;
}

body {
  padding: 10px;
}

ul {
  list-style-type: none;
  display: table;
  margin: 0 auto;
}

ul>li {
  float: left;
}

ul>li+li {
  margin-left: 5px;
  padding-left: 5px;
  border-left: 1px solid #bbb;
}
</style>
</head>
<body>
  <ul>
    <li><img src="http://placehold.it/60x80" /></li>
    <li><img src="http://placehold.it/60x80" /></li>
    <li><img src="http://placehold.it/60x80" /></li>
    <li><img src="http://placehold.it/60x80" /></li>
  </ul>
</body>
</html>

The code above is rendered as follows: