Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

How to Create a Cutout Text using HTML and CSS ?

  • Last Updated : 17 Jun, 2021

Cutout text is used as a background header of the webpage. The cutout text creates an attractive look on the webpage. To create a cutout text we will use only HTML and CSS. We display the cutout text and then we make the text blending of an element’s background with the element’s parent. The CSS mix-blend-mode property is required to do that. Divide this article into two sections creating structure and then we will apply CSS on that structure.

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

Creating Structure: In this section, we will only make the cutout text structure by using HTML.

  • HTML Code: 

HTML






<!DOCTYPE html>
<html>
 
<head>
    <title>
        Creating Cutout text with HTML and CSS
    </title>
 
</head>
 
<body>
    <div class="container">
         
        <!-- Cotout tex -->
        <h1 class="text">GeeksforGeeks</h1>
         
<p>
            "A Computer Science Portal<br>   
            for Geeks"
        </p>
 
    </div>
</body>
 
</html>

Designing the Structure: In this section we will apply some CSS property on created cutout text structure. The CSS mix-blend-mode property will play the main role and other things are totally depends on your designing knowledge. 

  • CSS Code: 

HTML




<style>
         
    /* container class styling */
    .container {
             
        /* Background image */
        background-image: url(
        background-size: cover;
        height: 360px;
        position: relative;
        text-align: center;
    }
         
    /* Cutout text class styling */
    .text {
        background-color: black;
        color: white;
        font-size: 68px;
        font-weight: bold;
        margin: 0 auto;
        padding: 15px;
        border: 5px solid gray;
        position: absolute;
        top: 25%;
        left: 23%;
        mix-blend-mode: multiply;
    }
         
    .text:hover {
    }
         
    /* Styling p tag element */
    p {
        position: absolute;
        left: 58%;
        top: 58%;
        color: white;
        text-align: right;
        font-style:italic;
         
    }
</style>

Final Solution: In this section we will combine the HTML and CSS file together and create a cutout text for the header of webpage. 

HTML




<!DOCTYPE html>
<html>
 
<head>
    <title>
        Creating Cutout text with HTML and CSS
    </title>
    <style>
         
        /* container class styling */
        .container {
             
            /* Background image */
            background-image: url(
            background-size: cover;
            height: 360px;
            position: relative;
            text-align: center;
        }
         
        /* Cutout text class styling */
        .text {
            background-color: black;
            color: white;
            font-size: 68px;
            font-weight: bold;
            margin: 0 auto;
            padding: 15px;
            border: 5px solid gray;
            position: absolute;
            top: 25%;
            left: 23%;
            mix-blend-mode: multiply;
        }
         
        .text:hover {
        }
         
        /* Styling p tag element */
        p {
            position: absolute;
            left: 58%;
            top: 58%;
            color: white;
            text-align: right;
            font-style:italic;
         
        }
    </style>
</head>
 
<body>
    <div class="container">
         
        <!-- Cotout tex -->
        <h1 class="text">GeeksforGeeks</h1>
         
<p>
            "A Computer Science Portal<br>   
            for Geeks"
        </p>
 
    </div>
</body>
 
</html>

Output: 

 




My Personal Notes arrow_drop_up
Recommended Articles
Page :