如何在达到最小宽度时将div浮动到左侧?

时间:2022-02-24 20:25:53
 <div id="container">
    <div id="subsSection">
       <div class="leftSection">ss</div>
       <div class="rightSection">ss</div>
  </div>

 </div>

(1) I want the subsection div, to be centered on the screen. but when its min-width have been reach on re size, then float to the left and no longer be centered. this is to use the left margin space.

(1)我希望subsection div在屏幕上居中。但是当它的最小宽度达到了重新尺寸时,则浮动到左边并且不再居中。这是使用左边距空间。

Demo

1 个解决方案

#1


0  

use media query for this

使用媒体查询

css

@media only screen and (min-width:768px){
    #subsSection{
        width:20%;
        float:left;        
    }
}

#1


0  

use media query for this

使用媒体查询

css

@media only screen and (min-width:768px){
    #subsSection{
        width:20%;
        float:left;        
    }
}