简体   繁体   English

在 Google 网站中设置 Google Apps 脚本背景

[英]Set Google Apps Script Background in Google sites

I've run into an issue with embedding a Google Apps Script HTML into my Google Site in that the default white background doesn't fit with the theme of the website.我在将 Google Apps 脚本 HTML 嵌入到我的 Google 站点时遇到了问题,因为默认的白色背景不符合网站的主题。

Is it at all possible to get the Google Apps Script HTML to have a transparent background or change the background colour of the Google Apps Script to suite it more?是否有可能让 Google Apps 脚本 HTML 具有透明背景或更改 Google Apps 脚本的背景颜色以使其更适合它? I've done alot of research but I have yet to find anyone who has found a solution to this issue.我做了很多研究,但我还没有找到任何人找到了解决这个问题的方法。

By default, HtmlElements have a transparent background.默认情况下,HtmlElements 具有透明背景。 The current version of Google Sites doesn't allow to set an embedded element as transparent either by inserting a Google Apps Script web app or by using <iframe> tag with the allowtransparency="true" attribute.当前版本的 Google 协作平台不允许通过插入 Google Apps 脚本 web 应用程序或使用带有allowtransparency="true"属性的<iframe>标记来将嵌入元素设置为透明。

The workaround is to inspect the Google Sites page that will contain the embedded element and set the background color of that element to match it.解决方法是检查将包含嵌入元素的 Google 协作平台页面并设置该元素的背景颜色以匹配它。 Let say that your site has a green background, the following shows one way to set the background color of the body element of the Google Apps Script web app to green :假设您的站点具有green背景,以下显示了一种将 Google Apps Script web 应用程序的正文元素的背景颜色设置为green的方法:

Code.gs代码.gs

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('index');
}

index.html索引.html

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <style>
      body {
        background-color: green;
      }
    </style>
  </head>
  <body>
    <p>Hello world!</p>    
  </body>
</html>

Related有关的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM