CSS Layout How to - Float two div to right








Question

We would like to know how to float two div to right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.main {<!--  w  w w  .j  a va 2s  . c om-->
  overflow: hidden;
}

.stop {
  float: right;
}

.start {
  float: right;
  clear: right;
}
</style>
</head>
<body>
  <div class="main">
    <div class="stop">Stop</div>
    <div class="start">Start</div>
  </div>
</body>

</html>

The code above is rendered as follows: