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

前端 未结 9 2204
别跟我提以往
别跟我提以往 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:25

    You can do this with CSS:

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

    We're using max-width, because we want to make an exception to the CSS, when a screen is smaller than the 1026px. min-width would make the CSS rule count for all screens of 1026px width and larger.

    Something to keep in mind is that @media queries are not supported on IE8 and lower.

提交回复
热议问题