When browser width becomes under 600px, I'd like such a position change, thanks to a media query :
It seems that this would need to swap div position. Is this possible with CSS?
* { padding: 0; margin: 0; }
#a { float: left; background-color: red; width: 150px; }
#b { background-color: blue; }
#c { float: right; width: 40%; background-color: yellow; }
@media (max-width: 600px) {
/* ... */
}
<div>
<div id="a">a</div>
<div id="c">c</div>
<div id="b">b</div>
</div>
Yes, it's possible with CSS. In fact, it's quite easy with flexbox, which is designed for such a task.
To learn more about flexbox visit:
Benefits of flexbox:
Browser support:
Flexbox is supported by all major browsers, except IE 8 & 9. Some recent browser versions, such as Safari 8 and IE10, require vendor prefixes. For a quick way to add all the prefixes you need, use Autoprefixer. More details in this answer.
You only need to reset the float or width properties.
Do mind the BFC block formating context when you deal with floating and non floatting elements.