With today's mobile responsive WordPress themes, the look of your website on a mobile phone is more important than ever and certain considerations should be put into your website design for mobile phones.

Hide HTML Code on Mobile

How does your website look on mobile? Easy to view? Easy to navigate? Perhaps there are some occasions that you may want to hide a video, images or anything else on a mobile phone to make it more user-friendly.

Sometimes you may want to hide certain things on mobile phones only.

Here is how to hide any website content from a mobile phone only.

From your WordPress theme, you can either add this to your themes CSS editor or add this code directly to your stylesheet, (style.css).  You can also add it directly to your HTML in HEAD the section. (One or the other, not both.)

Once that is saved to your stylesheet or websites HEAD section, the rest is really simple.

Around the text/image/video that you would like to hide from mobile devises, add the code highlighted in yellow in front and behind the section from your HTML or Text Editor. (In other words, don't add this from the visual editor)

<div class="mobileHide">Text/Image/Video That is NOT for Mobile</div>


There ya have it, happy mobile hiding!

PS. Depending on what WordPress theme you are using, all of this extra coding can be avoided by using Divi Theme.

They have a built in editor that you can change what is visible or not visible on PC, Tablet and Mobile.

SEO Alien
"Helping small businesses with smaller budgets compete with big brands with bigger budgets in the online market space since 2009."

About the Author:

The SEO-Alien is a project started in 2009 regarding all things online marketing. The site started out more of a diary of predictions, suggestions and references to things I frequently used for online marketing... before social media marketing was even an option.

I hope you find the information and tools presented here useful and something worth sharing with others.

If there is anything else about online marketing or any online advertising strategy you think would be helpful, please let me know.


Some of the links on this page may be "affiliate links", a link with a special tracking code. This means we may get paid commission on sales of those products or services we write about. The price of the item is the same whether it is an affiliate link or not. Regardless, we only recommend products or services we have used, tested and believe will add value to our readers and our editorial content is not influenced by advertisers or affiliate partnerships. Basically, we may earn some much needed 🐶 biscuit money, and we genuinely appreciate your support.

This disclosure is provided in accordance with the Federal Trade Commission’s 16 CFR § 255.5: Guides Concerning the Use of Endorsements and Testimonials in Advertising.