HTML Element Style How to - Add : for dd








Question

We would like to know how to add : for dd.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
dl {<!--from   w  w w. j a  va  2 s .  c o m-->
  width: 400px;
}

dt {
  display: inline-block;
  width: 100px;
}

dd {
  display: inline-block;
  width: 290px;
  margin: 0;
  padding: 0;
}

dd:before {
  content: ':';
}
</style>
</head>
<body>
  <dl>
    <dt>Item 1</dt>
    <dd>Text 1</dd>
    <dt>Item 2</dt>
    <dd>Text 2</dd>
    <dt>Item 3</dt>
    <dd>Text 3</dd>
  </dl>
</body>
</html>

The code above is rendered as follows: