HTML Form How to - Flow text around button








Question

We would like to know how to flow text around button.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.formLine {<!--  w  ww  .j a  va2 s  .  c  om-->
  width: 50%;
  outline: 2px dotted red;
}

.formLine span {
  display: block;
  overflow: hidden;
  padding-right: 5px;
}

.formLine input, .formLine em {
  width: 100%;
}

.formLine button {
  outline: 1px dashed blue;
  width: auto;
  float: right;
}
</style>
</head>
<body>
  <div class="formLine">
    <button>start</button>
    <p>Some line with a few words that are not too
        long. As you can see, the text tries to flow around the button on
        the right.Some line with a few words that are not too
        long. As you can see, the text tries to flow around the button on
        the right.</p>
  </div>
</body>
</html>

The code above is rendered as follows: