Page Widget How to - Limit Characters Displayed








Question

We would like to know how to limit Characters Displayed.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.test {<!--   www  .  ja  v  a  2 s  .c  o m-->
  width: 150px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
</style>
</head>
<body>
  <div class="test">This is a test. This is a test.This is a test.</div>
</body>
</html>

The code above is rendered as follows: