How To Add Image In Text Background Using Html and Css

admin_img Posted By Bajarangi soft , Posted On 08-10-2020

In this article, we will use HTML and CSS to set the image in the text background. To set the image in the text background, some CSS property is used,The CSS property is used to set the image as background in the text. The background-image property is used to set an image as background. The -webkit-text-fill-color property is used to give the text a transparent color, the background image will show through the text, thus completing the clippin

Image In Text Background

HTML Code:
 HTML code is used to create a basic structure of the body. In the following code, we will use paragraph tag to write text content.

<!DOCTYPE html>
<html>

<head>
    <title>
        How to Add Image in Text Background
        using HTML and CSS ?
    </title>
</head>

<body>
<p>Bajarangi Soft</p>
</body>

</html>
CSS Code: 
The CSS property is used to set the image as background in the text. The background-image property is used to set an image as background. The -webkit-text-fill-color property is used to give the text a transparent color, the background image will show through the text, thus completing the clipping effect.
<style>
    p {
        background-image: url(b2.jpg);
        background-repeat: repeat;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        margin-top: 200px;
        font-size: 120px;
        text-align: center;
        font-weight: bold;
        text-transform: uppercase;
        font-family: 'Steelfish Rg', 'helvetica neue',
        helvetica, arial, sans-serif;
        font-weight: 800;
        -webkit-font-smoothing: antialiased;
    }
</style>
Complete Code:
 In this section, we will combine the above two sections to add an image as text background.
<!DOCTYPE html>
<html>

<head>
    <title>
        How to Add Image in Text Background
        using HTML and CSS ?
    </title>

    <style>
        p {
            background-image: url(b2.jpg);
            background-repeat: repeat;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            margin-top: 200px;
            font-size: 120px;
            text-align: center;
            font-weight: bold;
            text-transform: uppercase;
            font-family: 'Steelfish Rg', 'helvetica neue',
            helvetica, arial, sans-serif;
            font-weight: 800;
            -webkit-font-smoothing: antialiased;
        }
    </style>
</head>

<body>
<p>BAJARANGI SOFT</p>
</body>

</html>

Related Post