<!DOCTYPE html>
<html>
<head>
<title>Title of the document</title>
<style>
body {
display: flex;
}
div {
background: #c579d1;
}
@media (orientation: landscape) {
body {
flex-direction: row;
}
}
@media (orientation: portrait) {
body {
flex-direction: column;
}
}
</style>
</head>
<body>
<div>First box</div>
<div>Second box</div>
<div>Third box</div>
</body>
</html>