How to create a comparison table with CSS?

CSSWeb DevelopmentFront End Technology

To create a responsive table with CSS, the code is as follows −


 Live Demo

<!DOCTYPE html>
<meta name="viewport" content="width=device-width, initial-scale=1">
   table {
      border-collapse: collapse;
      border-spacing: 0;
      width: 100%;
      border: 1px solid #ddd;
   th, td {
      text-align: center;
      padding: 16px;
      font-weight: bold;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      font-size: 18px;
   th:first-child, td:first-child {
      text-align: left;
   tr:nth-child(even) {
      background-color: #f2f2f2
<h1 style="text-align: center;">Comparison Table Example</h1>
<th style="width:50%">Features</th>
<td>Customer Support</td>
<td>1 Year</td>
<td>5 Years</td>


The above code will produce the following output −

Published on 07-May-2020 14:13:51