I've come across a similar layout before, but I'm struggling to replicate it myself.
The idea is to have text aligned on the left side with an image floated to the right.
Instead of the image appearing below the text when the window size is reduced, we'd like it to appear above the text.
This is my attempt at solving it. Any suggestions on improving this approach?
<!doctype html>
<html>
<head>
<style type="text/css">
.left{
width:60%;
position:absolute;
padding:0px 30px;
}
.right{
width:250px;
height:250px;
background-color:red;
float:right;
margin:0px 30px;
}
@media screen and (max-width: 800px) {
.left{
width:90%;
top:275px;
}
.right{
float:none;
margin: 0 auto;
}
}
</style>
</head>
<body>
<p class="left">"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
<div class="right"></div>
</body>
</html>
Check out this jsfiddle for a live demo: https://jsfiddle.net/4aerjgd6/
P.S. Could someone explain why a horizontal scroll bar appears when the window is resized very small in this example - any workaround for this?
Appreciate your help, W