HTML Element Style How to - Display 7 div in 2 column








Question

We would like to know how to display 7 div in 2 column.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#big_div {<!-- w ww. j a  va 2 s.c o m-->
  -webkit-column-count: 2;
  -moz-column-count: 2;
  column-count: 2;
}

#big_div div:nth-child(3) {
  -moz-column-break-after: always;
  -webkit-column-break-after: always;
  break-after: always;
}
</style>
</head>
<body>
  <div id="big_div">
    <div>1</div>
    <div>2</div>
    <div>3</div>
    <div>4</div>
    <div>5</div>
    <div>6</div>
    <div>7</div>
  </div>
</body>
</html>

The code above is rendered as follows: