Page Widget How to - Align text left and right








Question

We would like to know how to align text left and right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.outf {<!--   w  w  w.  jav a2 s.  com-->
  border-color: #3377bb;
  border-style: double;
  border-width: 2px;
  overflow: hidden;
  width: 750px;
  padding: 8px;
}

.right {
  text-align: right;
  float: right;
}

.left {
  text-align: left;
  float: left;
}
</style>
</head>
<body>
  <div class="outf">
    <h3 class="left">Text</h3>
    <h3 class="right">more text</h3>
    <h3 class="right">some more text</h3>
      
  </div>
</body>
</html>

The code above is rendered as follows: