Wondering how to hide a <div> tag from mobile users? Here’s a quick CSS fix on how to do that. You can make use of the Mobile CSS tags.
There are various reasons why you may want to hide a div from your users. Take note that this method works not only for div tags but all HTML tags. You can use this trick easily using CSS.
Easily Hide <div> tags From Mobile Devices
First, determine the div tag you want to hide your mobile devices for an easy overview we will make an example below.
<div class="hidemobile">
<h2>This div will be hidden</h2>
<p>No, you can't see this tag if you are using mobile</p>
</div>
@media only screen and (max-width: 600px) {
.hidemobile
{display:none;}
}
Parameters used:
Media Screen set to Max-width 600px meaning only screens with less than 600px are able to see the content under this tag.
You can set multiple screen sizes depending on how you use it.