Loading ...
photo

How to Hide Sidebar on Mobile Screens

How to remove the sidebar completely when people are viewing on mobile, then maybe add another container at the top of the page with the logo in. This way there's a lot more room for the page to breathe since it's just a 100% width container, above another, above another. Is it possible just to make the changes to the CSS and HTML you want within an @media bracket? Any help appreciated!<pre>&lt;div id="sidenav"&gt;<br>&nbsp; &nbsp; &lt;img id="logo" src="Images/Logo.png"&gt;<br>&nbsp; &nbsp; &lt;a href="#first"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Home&lt;/p&gt;<br>&nbsp; &nbsp; &lt;/a&gt;<br>&nbsp; &nbsp; &lt;a href="#second"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;What?&lt;/p&gt;<br>&nbsp; &nbsp; &lt;/a&gt;<br>&nbsp; &nbsp; &lt;a href="#third"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Who?&lt;/p&gt;<br>&nbsp; &nbsp; &lt;/a&gt;<br>&nbsp; &nbsp; &lt;a href="#fourth"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &lt;p&gt;Contact&lt;/p&gt;<br>&nbsp; &nbsp; &lt;/a&gt;<br>&lt;/div&gt;</pre>

You have the right idea, but there are a couple things that need to be changed. Instead of using max-height it would be better to use max-width. Usually, 768px is considered the breakpoint for mobile width vs. desktop width (remember that users can turn their phones sideways and that there are some large phones). Also, there was a missing curly brace. If you change all of that, you will end up with this:

@media (max-width: 768px) {
    #sidenav {
        display: none;
    }
}
{{'#'+category.name}}{{'#'+tag.name}}
{{ model.post.votes_count }}Likes
Load more comments +

arrow