Image Replacement in Bootstrap using text-hide Class

Bootstrap allows us to replace the text with background image for any text element like paragraph element, heading element etc. With the use of .text-hide class, we can replace an element’s content with a background image.


<element class = "text-hide" 
         style = "background-image: url('Specify URL of image here');">

In the above syntax, the text-hide class is used to first hide the text of the element and a background image is added to the element using the CSS background-image property.






    <!-- Link Bootstrap CSS and JS -->
    <link href="" rel="stylesheet">
    <h1 class="text-hide" 
               background-repeat: no-repeat; 
               width: 500px; height: 500px; ">



Note: This class also helps in improving the SEO of a website, as using this class we can add images to the website using heading tags, and use of heading tags is found to be good for a Webpage’s SEO.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.