Hide div element when screen size is smaller than a specific size

前端 未结 9 2167
别跟我提以往
别跟我提以往 2020-12-04 17:41

I have a div element that I want to hide when the width of the browser is less than or equal to 1026px. Is this possible to do with the css: @media only scr

9条回答
  •  眼角桃花
    2020-12-04 18:13

    You simply need to use a media query in CSS to accomplish this.

    @media (max-width: 1026px) {
        #fadeshow1 { display: none; }
    }
    

    Unfortunately some browsers do not support @media (looking at you IE8 and below). In those cases, you have a few options, but the most common is Respond.js which is a lightweight polyfill for min/max-width CSS3 Media Queries.

    
    

    This will allow your responsive design to function in those old versions of IE.
    *reference

提交回复
热议问题