Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent Google Translator from changing height of html to 100%

I added a Google Translator widget to a site (using the code provided here: http://translate.google.com/translate_tools) and have the following issue:

It automatically adds a style attribute to the html tag whose value includes:

height: 100%

This is "breaking" the page layout. For example, CSS backround images that were positioned to "bottom" are now (incorrectly) positioned at the bottom of the view port.

Is there any way to prevent or fix this?

like image 323
edt Avatar asked Aug 25 '10 04:08

edt


People also ask

How do I stop HTML translation?

For example, if you have an entire page that should not be translated, you can add <meta name="google" value="notranslate"> inside the head element of your page and Google won't translate any of the content on that page. (However they also support <meta name="google" content="notranslate"> .)

Is Google Translate deprecated?

Google Translate is still available for very narrow purposes and use cases. Specifically, to quote Google's official resource: [The website widget can be used by] government, non-profit, and/or non-commercial websites (for example, academic institutions) that focus on COVID-19 response.


3 Answers

This resolves the issue:

/* Google Translate Overrides */
html, body{
    min-height: 0!important;
    height: auto!important;
    position: inherit!important;
}
like image 128
greg Avatar answered Oct 22 '22 06:10

greg


I was able to solve this by setting the body min-height attribute in css as !important to prevent override.

body {
min-height: 0 !important;
}

UPDATE - Unfortunately, this no longer works. The Google Translation script will strip out any attempts you make to counter it's min-height style. I have both the above CSS in my stylesheet AND an inline style on the body tag.

The Google Translation script is pretty aggressive and I'm not seeing any way to disable this.

like image 40
Adam Avatar answered Oct 22 '22 04:10

Adam


This should work:

html {
  height: auto !important;
}

body {
  position: initial !important;
  min-height: initial !important;
  top: auto !important;
}
like image 35
arielcalcano Avatar answered Oct 22 '22 05:10

arielcalcano