How to create a 2-column layout grid with CSS?

CSSWeb DevelopmentFront End Technology

To create a 2-column layout grid with CSS, the code is as follows −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1" />
   body {
      font-family: Arial;
      color: white;
   .left, .right {
      height: 50%;
      width: 50%;
      position: fixed;
      overflow-x: hidden;
      padding-top: 20px;
   .left {
      left: 0;
      background-color: rgb(36, 0, 95);
   .right {
      right: 0;
      background-color: rgb(56, 1, 44);
   .centered {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      text-align: center;
   .centered img {
      width: 150px;
      border-radius: 50%;
<h1 style="color: black;">Two column layout grid example</h1>
<div class="left">
<h1>Some random text on the left</h1>
<div class="right">
<h1>Some random text on the right</h1>


The above code will produce the following output −

Updated on 12-May-2020 12:49:34