How to Make a Banner in HTML: A Step-by-Step Guide

3 Min Read

Creating an eye-catching banner is crucial for grabbing attention and making a strong impression on your website visitors. In this tutorial, we’ll explore how to make a banner in HTML, along with some CSS for styling. Let’s dive in!

Table of Contents

Setting up the HTML Structure

First, let’s set up the HTML structure for the banner. We’ll use the <header> element to create a container for the banner content, which includes a heading, a subheading, and a call-to-action (CTA) button:

<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Banner Example</title>
  <link rel="stylesheet" href="styles.css">
  <header class="banner">
    <h1>Welcome to Our Website</h1>
    <p>Discover our amazing products and services.</p>
    <a href="#" class="cta-button">Learn More</a>

Now that we have our HTML structure in place, let’s style the banner with CSS.

Styling the Banner with CSS

Create a new CSS file named “styles.css” and add the following styles to customize the appearance of the banner:

.banner {
  background-image: url('your-banner-image.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  text-align: center;
  padding: 100px 0;
  color: #fff;

.banner h1 {
  font-size: 48px;
  margin-bottom: 15px;

.banner p {
  font-size: 24px;
  margin-bottom: 30px;

.cta-button {
  display: inline-block;
  background-color: #f00;
  color: #fff;
  text-decoration: none;
  padding: 15px 30px;
  border-radius: 5px;
  font-size: 18px;

In the above CSS, we’ve set a background image for the banner and adjusted the text alignment, padding, and color. Additionally, we’ve styled the heading, subheading, and CTA button to make them more visually appealing.

Making the Banner Responsive

To make the banner responsive and ensure it looks great on all devices, we’ll use media queries in our CSS:

@media (max-width: 768 px) {
.banner {
padding: 50px 0;

.banner h1 {
font-size: 36px;

.banner p {
font-size: 18px;
margin-bottom: 20px;

.cta-button {
padding: 10px 20px;
font-size: 16px;

In the above media query, we’ve adjusted the padding, font sizes, and margins for devices with a screen width of 768 pixels or less, making the banner more mobile-friendly.


Now you know how to make a banner in HTML, style it with CSS, and make it responsive for various devices. By following this guide, you can create visually appealing banners that enhance your website’s appearance and improve user experience. Don’t hesitate to explore different styles and layout options to find the perfect look for your site.

Share this Article
Leave a comment