
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.
Creating Structure: In this section, we will only make the cutout text structure by using HTML.
HTML
<!DOCTYPE html>
<html>
<head>
<title>
Creating Cutout text with HTML and CSS
</title>
</head>
<body>
<div class="container">
<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
<style>
.container {
background-image: url(
background-size: cover;
height: 360px;
position: relative;
text-align: center;
}
.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 {
}
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">
<h1 class="text">
GeeksforGeeks
</h1>
<p>
"A Computer Science Portal<br>
for Geeks"
</p>
</div>
</body>
</html>
|
Output:

Learn to code easily with our course
Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated :
12 Jul, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...