Responsive email template example

Here is an example of a responsive email template:

HTML Structure:

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Responsive Email Template</title>
  <style>
    /* Add some basic styling to make the email look decent */
    body {
      font-family: Arial, sans-serif;
      font-size: 16px;
      line-height: 1.5;
      color: #333;
      margin: 0;
      padding: 0;
    }
   .container {
      max-width: 600px;
      margin: 0 auto;
      padding: 20px;
      background-color: #f9f9f9;
      border: 1px solid #ddd;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
   .header {
      background-color: #333;
      color: #fff;
      padding: 10px;
      text-align: center;
    }
   .header h1 {
      font-size: 24px;
      margin: 0;
    }
   .content {
      padding: 20px;
    }
   .content p {
      margin-bottom: 20px;
    }
   .button {
      background-color: #4CAF50;
      color: #fff;
      padding: 10px 20px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
    }
   .button:hover {
      background-color: #3e8e41;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="header">
      <h1>Responsive Email Template</h1>
    </div>
    <div class="content">
      <p>This is a responsive email template that adapts to different screen sizes and devices.</p>
      <p>It uses a combination of HTML, CSS, and media queries to ensure that the layout and design remain consistent across different email clients and devices.</p>
      <p><a href="#" class="button">Learn More</a></p>
    </div>
  </div>
</body>
</html>

Media Queries:

/* Add media queries to make the email responsive */
@media only screen and (max-width: 480px) {
 .container {
    width: 300px;
  }
 .header {
    font-size: 18px;
  }
 .content {
    padding: 10px;
  }
 .button {
    font-size: 14px;
    padding: 8px 16px;
  }
}

@media only screen and (max-width: 320px) {
 .container {
    width: 250px;
  }
 .header {
    font-size: 16px;
  }
 .content {
    padding: 8px;
  }
 .button {
    font-size: 12px;
    padding: 6px 12px;
  }
}

Explanation:

Tips and Best Practices: