apps脚本css按类不更改占位符颜色

时间:2016-05-01 05:55:15

标签: html css google-apps-script google-sites

我只想更改输入占位符的文本颜色。我正在Google Apps for Work“网站”应用中构建此页面。这是我正在使用的测试代码。我已经尝试过如此无数的组合而没有成功。 Heeeelp!

我的“索引”页面:

<?!= HtmlService.createHtmlOutputFromFile('Styles').getContent(); ?>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
    <div>
      <input type="text" class="required" id="yo" placeholder="test me" />
    </div>
  </body>
</html>

我的“样式”html:

<!-- This CSS package applies Google styling; it should always be included. -->
<link rel="stylesheet" href="https://ssl.gstatic.com/docs/script/css/add-ons.css">

<style>
<!--Set default style for all placeholder text-->
input.required:-webkit-input-placeholder {
   color: #FABBBB;
}

input.required:-moz-placeholder { /* Firefox 18- */
   color: #FABBBB;
}

input.required::-moz-placeholder {  /* Firefox 19+ */
   color: #FABBBB;
}

input.required:-ms-input-placeholder {
   color: #FABBBB;
}

</style>

这是我的“doGet”代码:

/**
 * Serves HTML of the application for HTTP GET requests.
 * If folderId is provided as a URL parameter, the web app will list
 * the contents of that folder (if permissions allow). Otherwise
 * the web app will list the contents of the root folder.
 *
 * @param {Object} e event parameter that can contain information
 *     about any URL parameters provided.
 */
function doGet(e) {
  var template = HtmlService.createTemplateFromFile('Index');

  // Retrieve and process any URL parameters, as necessary.
  if (e.parameter.folderId) {
    template.folderId = e.parameter.folderId;
  } else {
    template.folderId = 'root';
  }

  // Build and return HTML in IFRAME sandbox mode.
  return template.evaluate()
      .setTitle('Web App Window Title')
      .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

1 个答案:

答案 0 :(得分:2)

尝试:

input.required::-webkit-input-placeholder {
   color: #FABBBB;
}

注意,webkit的两个冒号。此页面列出了其他浏览器 - 但尚未测试。