CSS Property Value How to - Compare float right and left and tag sequence








Question

We would like to know how to compare float right and left and tag sequence.

Answer


<!DOCTYPE html>
<html>
<head>
<style>
.container {<!--   www .  j a  va2  s  .c o m-->
  border: 1px solid black;
  overflow: hidden;
}

.container DIV {
  width: 15px;
  border: 1px solid Blue;
  margin: 1px;
}
</style>
</head>
<body>
  <div style="width: 200px;" class="container">
    <div style="float: left;">1</div>
    <div style="float: left;">2</div>
    <div style="float: left;">3</div>
    <div style="float: left;">4</div>
    <div style="float: right;">5</div>
    <div style="float: right;">6</div>
    <div style="float: right;">7</div>
    <div style="float: right;">8</div>
  </div>
</body>
</html>

The code above is rendered as follows: