css - How do I make an icon disappear on mobile? -


hopefully simple answer. have page on desktop needs series of share icons (fb, tw, ig) underneath paragraph of text. on mobile, these icons included in template don't need them show. looks repetitive. using cms , have access body text of page, not headers, extensive javascript isn't ideal. inline css styling or other such magic make div disappear? , can shrink on verified mobile devices or better browser window size?

currently code simple:

<html>     <body>         text here.         <div id="mydiv">             <img src="/some/icon1.png">             <img src="/some/icon2.png">             <img src="/some/icon3.png">         </div>     </body> </html> 

all need make "mydiv" disappear if i'm using iphone, ipad, or android device...

thank you!

you can use media queries:

a media query consists of media type , 0 or more expressions limit style sheets' scope using media features, such width, height, , color.

when media query true, corresponding style sheet or style rules applied, following normal cascading rules.

documentation:

for example:

@media (max-width: 787px) {    #mydiv {      display: none;    }  }
some text here.  <div id="mydiv">    <img src="/some/icon1.png">    <img src="/some/icon2.png">    <img src="/some/icon3.png">  </div>


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -