Forum Moderators: not2easy
[edited by: not2easy at 7:24 pm (utc) on Nov 11, 2020]
[edit reason] no links please [/edit]
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title> Switching column order for mobile display</title>
<style>
* {
box-sizing: border-box;
}
/* Create two unequal columns that float next to each other */
.column {
float: left;
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
.left {
width: 62%;
}
.right {
width: 38%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* go full width at 480px */
@media only screen and (max-width: 480px) {
.left { width:100%}
.right { width:100%}
.column{ clear:both}
}
</style>
</head>
<body>
<h2>Two Unequal Columns</h2>
<div class="row">
<div class="column left" style="background-color:#aaa;">
<h2>Column 1</h2>
<p>Some text..</p>
</div>
<div class="column right" style="background-color:#bbb;">
<h2>Column 2</h2>
<p>Some text..</p>
</div>
</div>
</body>
</html>
.column {
padding: 10px;
height: 300px; /* Should be removed. Only for demonstration */
}
.row{
display:flex;
flex-direction: row-reverse;
}
@media (min-width: 480px) {
.row {
flex-direction: row-reverse;
}
}
<style>
* { box-sizing: border-box;}
.box {
height: 300px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
/* Create two unequal columns that float next to each other */
.column {padding: 10px;}
.row{
display:flex;
flex-direction: column-reverse;
}
.left {width: 100%;}
.right {width: 100%;}
p { font-size: 1.3em; font-weight:bold}
@media (min-width: 480px) {
.row {flex-direction: row;}
.left {width: 62%;}
.right {width: 38%;}
}
</style>