我想要有两列(内容和侧盒),其中sidebox将具有固定的宽度,并且内容将缩小为必要的。css两列 - 一个固定宽度
在某些时候,他们都会堆叠到100%的宽度,但我想先拥有内容。这个解决方案的问题是sidebox最先出现。
我不想使用浮动和百分比,因为我不想缩小边框。
HTML:
<aside class="sidebox"> <!-- i don't want this to come first after media query applied -->
sidebox
</aside>
<section class="content">
content
</section>
CSS:
.content {
margin-right:200px;
height:100px;
background-color:red;
}
.sidebox{
width:180px;
float:right;
height:100px;
background-color:yellow;
}
@media (max-width: 500px) {
.sidebox {
float:none;
width: auto;
}
.content {
margin-right:0px;
}
}
DEMO:https://jsfiddle.net/72Lad2zf/