Hi to everyone.
I found a very simple bit of code to make two columns. What I'm trying to do is make 'Column 2' be first instead of second when it goes mobile-display at 480px.
Note: I didn't place a link to a page to show the visual aspect since I'm not sure if you're allowed to do that here.
Here is the code:
I found a very simple bit of code to make two columns. What I'm trying to do is make 'Column 2' be first instead of second when it goes mobile-display at 480px.
Note: I didn't place a link to a page to show the visual aspect since I'm not sure if you're allowed to do that here.
Here is the code:
Code:
<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>