简体   繁体   English

带有CSS @HTML最大宽度的HTML无法正常工作

[英]Html with css @media max-width not working

When using brackets to code my website, the @media worked and would make divs appear and disappear to support mobile screens. 使用方括号对我的网站进行编码时,@ media可以正常工作,并且会使div出现和消失以支持移动屏幕。 But after uploading to my hosting site, it does not work and all the elements are showing at once. 但是上传到我的托管网站后,它不起作用,所有元素都立即显示。 How can I fix this? 我怎样才能解决这个问题? The relevant CSS code is below. 相关的CSS代码如下。

CSS: CSS:

@media (max-width : 720px) {
    .disappear {
        display: none;
    }
    #menuposition {
        margin-left: auto;
        margin-right: auto;
    }
    .galleryitem {
        width: 100%
    }
    .containergallery {
        max-width: 250px;
        padding-top: 0%;
    }
}
@media (min-width : 721px) {
    .reappear {
        display: none;
    }
    #menuposition {
        right: 0px;
        position: absolute;
    }
}
@media (max-width : 960px) {
    .galleryitem {
        width:100%
    }
    .containergallery {
        max-width: 300px;
        padding-top: 10px;
    }
}

That page you linked to doesn't have that CSS in the source anywhere and none of the linked files have it either. 您链接到的页面在任何地方的源代码中都没有该CSS,而且任何链接文件也都没有。

Link the CSS to the page or place it in an inline-style element. 将CSS链接到页面或将其放置在嵌入式样式元素中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM