HTML Element Style How to - Float h3 left and right








Question

We would like to know how to float h3 left and right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.outf {<!--  w w  w.  j  a  v  a2s .co m-->
  border-color: #3377bb;
  border-style: double;
  border-width: 2px;
  width: 750px;
  padding: 8px;
  float: left;
}

.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: