How can I remove header/banner from web page when translator switch language

105 views Asked by At

I have integrated Google Translate API and it is working well but the problem is when content is translated, after that it appears a header/banner from Google Translate. I just want to remove that header from the website. Please fix it for me that would be great. I have attached a screenshot of the page and header please check.

Screenshot of translator banner at top of web page:

enter image description here

I inspected the page changed it into CSS and made the class of banner display: none and at that time it disappeared but when I made the same changes to my code it did not work while I was changing CSS in the code, following is the simple code in html kindly fix it.

<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .VIpgJd-ZVi9od-ORHb {
      display: none !important;
    }
  </style>
</head>

<body>
  <h1>Hi, my name is Ali Naqvi</h1>
  <div id="google_element"></div>
  <script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=loadGoogleTranslate"></script>

  <script type="text/javascript">
    function loadGoogleTranslate() {
      new google.translate.TranslateElement("google_element")
    };
  </script>
</body>

</html>

1

There are 1 answers

1
Prince Bagthariya On

You can remove header with the help of CSS :

.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-l4eHX-hSRGPd,
.VIpgJd-yAWNEb-L7lbkb,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf-ti6hGc {
    display: none !important;
}