Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is due to the <code>position: fixed</code> property on the <code>.navigation</code> element.</p> <p>Fixed positioning removes the element from the document flow, meaning its position does not affect the positioning of subsequent elements (similar to <code>position: absolute</code> but 'fixed' does not establish a new offset context and is always positioned relative to the window rather than the document or offset context).</p> <p>Your <code>.content</code> element has <code>margin-top: 100px</code>, which works to offset the content beneath the navigation when the site is shown on a desktop screen because the <code>.navigation</code> element is not taller than 100px.</p> <p>However, when the screen/viewport size shrinks as it does on a mobile browser, the <code>.navigation</code> element gets taller to accommodate its content because <code>#nav</code> wraps beneath <code>#logo</code> since there is no room to put them side by side. Once it gets taller than 100px it begins to overlap with the <code>.content</code> because the <code>margin-top</code> on <code>.content</code> has has not been increased accordingly to make room for the taller <code>.navigation</code>. (The height of <code>.navigation</code> has no impact on the position of <code>.content</code> because of its <code>fixed</code> positioning as previously explained).</p> <p>The solution is to add a media query that increases <code>margin-top</code> when needed. I can't tell you the breakpoint or values exactly that you need, but tweaking the <code>max-width</code> and <code>margin-top</code> pixel values here should get you what you need:</p> <pre><code>@media only screen and (max-width: 320px) { .band.content { margin-top: 140px; } } </code></pre> <p>A more precise solution involves using JS to set the <code>margin-top</code> of <code>.content</code> dynamically based on the height of <code>.navigation</code> (using jQuery, and adding 20px of spacing between the two elements):</p> <pre><code>$(document).ready(function() { $('.band.content').css('margin-top', $('.navigation').outerHeight() + 20); } </code></pre>
    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.
 

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