Two Divs next to each other, that then stack with responsive change

前端 未结 6 861
感情败类
感情败类 2020-11-28 02:17

I\'m trying to achieve something that I am sure should be easier than I am making it!

I am using the Skeleton responsive framework, and have been fine up until now.<

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-28 03:10

    With a mediaquery based on a min-width you could achieve something like http://jsbin.com/aruyiq/1/edit

    CSS

    .wrapper { 
      border : 2px dotted #ccc; padding: 2px; 
    }
    
    .wrapper div {
       width: 100%; 
       min-height: 200px;
       padding: 10px;
       -webkit-box-sizing: border-box;
       -moz-box-sizing: border-box;
       box-sizing: border-box;
    }
    #one { background-color: gray; }
    #two { background-color: white; }
    
    @media screen and (min-width: 600px) {
       .wrapper {
          height: auto; overflow: hidden; // clearing 
       }
       #one { width: 200px; float: left; }
       #two { margin-left: 200px; }
    }
    

    In my example the breakpoint is 600px but you could adapt it to your needs.

提交回复
热议问题