Page Widget How to - Float image to right and text to left








Question

We would like to know how to float image to right and text to left.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
p>img {<!-- w  w  w. j  ava 2  s. c  o  m-->
  float: right;
  margin: 0 0 10px 10px;
}
</style>
</head>
<body>
  <p class="aboutdes">
    <img
      src="http://www.java2s.com/style/download.png" />
    A quem consectetur, ut dolore non varias, nostrud noster qui
    expetendis eruditionem, culpa mandaremus non senserit. A magna fugiat
    dolore pariatur, ab quid consectetur et qui dolore litteris an malis
    commodo id nostrud.
  </p>
</body>
</html>

The code above is rendered as follows: