Search code examples
htmlcssimagesvg

Replace html span tag text with image


I would like to change the text "Confidențialitate & Cookie-uri" to an image (to this image) using CSS in the following code:

 <div id="cookie-law-info-again" data-nosnippet="true" style="background-color: rgb(37, 166, 226); color: rgb(255, 255, 255); position: fixed; font-family: inherit; width: auto; bottom: 0px; left: 20px;">
  <span id="cookie_hdr_showagain">Confidențialitate &amp; Cookie-uri</span>
</div>

on my website: link


Solution

  • Try this, and tell me if it works:

    #cookie_hdr_showagain {
      background: url(https://flexinstal.ro/wp-content/uploads/2023/10/cookies.svg);
      height: 50px;
      width: 50px;
      display: block;
      background-size: contain;
      background-repeat: no-repeat;
      font-size: 0;
    }
    <div id="cookie-law-info-again" data-nosnippet="true" style="background-color: rgb(37, 166, 226); color: rgb(255, 255, 255); position: fixed; font-family: inherit; width: auto; bottom: 0px; left: 20px;">
      <span id="cookie_hdr_showagain">Confidențialitate &amp; Cookie-uri</span>
    </div>