Creating text with integrated background

If you're looking for a very modern and effective way to style your headlines, take a look at how using a background to style the colour of your text can be incredibly innovative.
•
Updated on August 14, 2026
•
2 min read
Believemy logo

If you're looking for a very modern and effective way to style your headings, take the time to see how using a background to style the color of your text can be incredibly innovative.

You can find the entire tutorial on our Instagram account

 

Step 1

Let's start by creating the HTML structure of our heading.

HTML
<div class="banner">
        <h1 class="banner-title">BELIEVEMY</h1>
    </div>

We can easily omit the banner class if you want your background to take the full width of your text; you need to wrap it like this.

 

Step 2

Now, let's horizontally and vertically center the title within the banner class using flexbox:

CSS
.banner {
      width: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      height: 400px;
      background-color: #131416;
    }

 

Step 3

We just need to add the background to our banner-title class:

CSS
.banner-title {
      font-size: 7em;
      font-family: arial;
      background-image: url('banner.png');
      background-size: cover;
      background-position: center;
    }

But the result is not there yet. For now, we do have a background behind our text, but we're far from the desired outcome! Let's fix this problem with the secret ingredient.

 

Step 4

Simply use background-clip to define how the background extends: here, we specify that the background stops at the text, not at 100% of the div.

CSS
.banner-title {
      /* What we had in the previous step */
      background-clip: text;
      -webkit-background-clip: text;
      color: transparent;
    }

Then, by setting the color to transparent, we make our magnificent background appear on our superb title.

This trick is incredibly effective for website titles.

Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating a cascading animation on text

For a slogan or for an animation on a very important page of your project, this very modern effect is also very easy to achieve. Let's take a look at how to do it in this article.

December 9, 2024

Create a clean, modern timeline using html and css

Whether you want to show a purchasing process, the highlights of your career on your portfolio, or anything else, learn how to create a sleek, modern timeline to show it off!

December 9, 2024

Create a text rotation effect

To make your site more attractive, you could add this cool effect, which will display several words in succession with a looping deletion and rewriting effect. This effect can be placed at the end of a sentence, as in a text.

December 11, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

The complete guide to underlines (CSS)

All about all... You'll know all about underscores! All right, you recognize the music, don't you? In any case, underlines don't just underline our texts from time to time, they're a real stylization tool, allowing us to add bars below, but also above, in the form of waves, dotted lines, dashes... As you can see, we're going to take a look at all this in this article.

December 6, 2024

Create a very modern hover on a link

Here's an easy way to create a very modern hover on a link! There are lots of possible effects for buttons and links: the better they look, the more likely your users will be to click on them.

December 9, 2024

Playing with blurs and filters on presentation cards with CSS

Looking for a way to display your latest blog posts or projects in a modern, animated way? These cards will go perfectly with your website! Let's find out how to make them.

December 9, 2024

Create a twitter-style profile header

Whether you've run out of inspiration or you're trying to recreate a website like twitter, this article will help you create a profile inspired by those offered by twitter.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.