CSS Property Value How to - margin: 0 10px; Add space BETWEEN items








Question

We would like to know how to margin: 0 10px; Add space BETWEEN items.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
span {<!--   www .j  a v a2  s . c om-->
  margin: 0 10px;
  background: #faf;
}

span:first-of-type {
  margin-left: 0;
}

span:last-of-type {
  margin-right: 0;
}
</style>
</head>
<body>
  <span>text</span>
  <span>text</span>
  <span>text</span>
  <span>text</span>
  <span>text</span>
  <span>text</span>
</body>
</html>

The code above is rendered as follows: