html - Google 应用程序脚本 : style tags work in index. html 但不是 stylesheet.html

标签 html css jquery-ui google-apps-script

我是 GAS 的菜鸟,所以请原谅我的愚蠢问题...

我的非常简单的 css 样式在作为 index.html 的一部分时有效,但在作为 stylesheet.html 的一部分时无效。我究竟做错了什么?提前致谢!

index.html

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>

<script>
  $(function() {
    $( "#studPropTabs" ).tabs();
  });
</script>

<div id="studPropTabs">
  <ul>
    <li><a href="#mainTab">Basic Information</a></li>
    <li><a href="#schedTab">Schedule & Course Drops</a></li>
    <li><a href="#planTab">Planning</a></li>
    <li><a href="#miscTab">Off-campus & Partner Info</a></li>
  </ul>
  <div id="mainTab">
    <form id='propForm'>
      <fieldset>
        <div>
          <label class='mainForm' for='firstName' >First Name</label>
          <input type='text' id='firstName' />
         </div>
        <div>
          <label class='mainForm' for='lastName' >Last Name</label>
          <input type='text' id='lastName' />
        </div>
      </fieldset>
    </form>
    </div>

 </div>

stylesheet.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>

label {
display: inline-block;
width: 5em;
color: red;
}

</style>

code.gs

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('Index')
  .setTitle('Senior Project Proposal Form')
  .setSandboxMode(HtmlService.SandboxMode.IFRAME);
}

最佳答案

没有页面是永远包含的,必须指定,正如Good Practices中所说:

在 code.gs 中:

function include(filename) {
  return HtmlService.createHtmlOutputFromFile(filename)
      .setSandboxMode(HtmlService.SandboxMode.IFRAME)
      .getContent();
}

在 index.html 中:

<?!= include('Stylesheet'); ?>

关于html - Google 应用程序脚本 : style tags work in index. html 但不是 stylesheet.html,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31231380/

相关文章:

MacOS X 上的 HTML5 格式? (最好使用 TextMate)

css - VueJs - 重用组件并传递背景图像

jquery-ui - 工作日 jQuery UI 选项卡在当天打开

jquery - 更改 JQuery 对话框或 Google map Z 索引

html - header (<h2>) 标记内的换行符 (<br/>)

jQuery 选择框问题

python - 将绘图发送到 flask 中的 html 时出错

html - Html 表格列内的 div 之间不需要的间距

css - 在 Bootstrap 3 中调整不同设备的品牌标志

jquery - 圆形或圆形 Draggable/Droppables