简体   繁体   English

CSS / HTML:最小化浏览器时如何使左侧div响应崩溃

[英]CSS/HTML: How to make a left side div responsive that collapse when minimized the browser

So I have a two divs that are partitioning the page body, but I need to collapse the left side div when user minimizes the page. 因此,我有两个用于划分页面主体的div,但是当用户最小化页面时,我需要折叠左侧的div。 And when it click the collapsed side div, it goes back to previous. 当单击折叠的div侧边时,它可以返回到上一个。

html html

<div class="" style="display:flex; min-height:700px;">
        <div class="left_temp_sider">
            DIV1
        </div>
        <div class="right_temp_sider">
            DIV2
        </div>
</div>

css 的CSS

.left_temp_sider{
   min-width: 300px;
   margin-top:70px;
   padding:20px 0px 20px 35px; 
}
.right_temp_sider{
   flex:1;
}

这看起来像

Try media queries: need to reset min-width instead of max-width 尝试媒体查询:需要重置最小宽度而不是最大宽度

@media screen and (max-width: 600px) {
    .left_temp_sider{
         min-width: 50px;

    }
}

If your viewport width is less than 600px, the CSS rules specified inside @media will be applied. 如果您的视口宽度小于@media则将应用@media内部指定的CSS规则。

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

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