Marcell Nemeth
Marcell Nemeth

Reputation: 97

How to hide div content in php for mobile devices?

I using wordpress on this project and this is my class code line in my php file:

<div class="footer-banner">

Thats how I tried to hide from mobile devices but not working and really I dont know why:

@media screen and (max-width: 960px) {

div.footer-banner { display: none; }

}

Upvotes: 0

Views: 2452

Answers (3)

Andy Tschiersch
Andy Tschiersch

Reputation: 3816

Do you have set the meta viewport in HTML <head> correctly?

<meta name="viewport" content="width=device-width">

Upvotes: 0

Jatin Kalra
Jatin Kalra

Reputation: 186

For mobile devices you need to use media query, because mobile devices will takes width approx between 320px to 480px

@media screen and (max-width: 481px) {
.footer-banner { display: none; }
}

and remove other media queries.

Thanks

Upvotes: 0

Pravin Vavadiya
Pravin Vavadiya

Reputation: 3207

Try to something like this.

If You have use Boostrap then you can use boostrap class hidden-sm for hidden div in mobile view.

@media (max-width: 1199px) {
}

@media (max-width: 991px) {
}

@media (max-width: 767px) {
  .footer-banner{display:none}
}

Upvotes: 1

Related Questions