Search code examples
mobilegoogle-apps-scriptjquery-mobileweb-applications

Apps Script Web App elements are too small when viewed on a phone


On my phone, my select buttons end up being very small. I'm trying to get them to take up, combined, 100% of the horizontal space, so that each one will take up 33% of the horizontal space.

On my computer, they take up 100% of horizontal space, like I want.

How do I fix this for my mobile?

Edited screenshot from phone

html:

<div data-role="page" id="Gauntlet">
  <div data-role="header">
    <div data-role="navbar">
      <ul>
        <li><a href="#home" class="ui-btn-active ui-state-persist">Home</a></li>
      </ul>
    </div>
  </div>
  <div data-role="main" class="ui-content">
    <div data-role="collapsible-set">
      <div data-role="collapsible" data-collapsed="false" data-mini="true">
        <h3>Gauntlet Traits:</h3>
        <div class="ui-field-contain">
          <fieldset data-role="controlgroup" data-type="horizontal" class="custom-fieldset">
            <select id="myList1" data-mini="true"></select>
            <select id="myList2" data-mini="true"></select>
            <select id="myList3" data-mini="true"></select> 
          </fieldset>
        </div>
        <button type="button" id="submit" data-mini="true">Submit</button> 
      </div>
    </div>
    <div id="table_div"></div>
  </div>
  <div data-role="footer">
    <h2></h2>
  </div>
</div>

css:

.custom-fieldset .ui-controlgroup-controls {
    width: 100% !important;
}

.custom-fieldset .ui-controlgroup-controls .ui-select {
    width: 33.33% !important;
}

Solution

  • As written in view-port meta tag documentation,

    Meta tags included directly in an Apps Script HTML file are ignored. Only the following meta tags are allowed.

    So, add the meta tag server side:

    return HtmlService
            .createHtmlOutputFromFile('index')
            .addMetaTag('viewport', 'width=device-width, initial-scale=1');