How to make two columns with CSS

Sat, 13 Apr 2019 03:26

Two columns

column 1

column 2

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.row {
  display: flex;
  flex-direction: row;
}

.column {
  width: 50%;
}

@media (max-width: 600px) {
  .row {
    flex-direction: column;
  }
  .column {
    width: 100%;
  }
}
</style>
</head>
<body>

<h2>Two columns</h2>

<div class="row">
  <div class="column" style="background-color: green;">
    <h2>column 1</h2>
  </div>
  <div class="column" style="background-color: lime;">
    <h2>column 2</h2>
  </div>
</div>

</body>
</html>