Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat is the effect of the following CSS in a phonegap app?
    primarykey
    data
    text
    <p>What is the effect of including the following CSS? Initially this may seem like a silly question, but bear with me. I have the following page. Nothing too complicated, just a fixed header at the top with the h1 centered horizontally inside the header div. In a browser this works perfectly. However, this is to be used inside a phonegap 2.9.0 app.</p> <p>On a nexus 4, when the screen rotates, the h1 is no longer centered horizontally <strong>unless</strong> the "orientations from js" css is included. But I don't even have the class in the @media selector in my HTML page at all. Admittedly I copied the orientation css from jquery mobile's css file, but only to understand how they were able to get their h1 to always center even upon device orientation change. <strong>I am not using jquery mobile.</strong></p> <p>Can someone please explain this mystery? </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;&amp;nbsp;&lt;/title&gt; &lt;meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1"&gt; &lt;style&gt; /*CSS WITH THE CORRECTING EFFECT*/ @media screen and (orientation: portrait){ .nonExistantClass {} } /* OR THIS ONE! */ @media screen and (orientation: landscape){ .anotherNonExistantClass {} } /*END CSS WITH THE CORRECTING EFFECT*/ .header h1{ font-size:1.4em; margin: 0 30%; } .header { left: 0; right: 0; width: 100%; top:0; position: fixed; z-index: 1000; background:black; color:white; height:2.4em; line-height:2.4em; text-align:center; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;div class="header"&gt; &lt;h1&gt;Title&lt;/h1&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>UPDATE</strong>: I have narrowed it down a bit. My initial question was about classes ui-mobile and ui-page. However the same CSS from before with changed class names has the exact same effect.</p> <p>Further, I only need one of the two @media selectors to exhibit the mentioned behaviour. I have updated my question.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload