img float left on mobile and centered
I'm trying to get a right floated image around text on desktop to float left and centered when viewed on mobile devices with the paragraph dropped below the image.
HTML
<div id="image-wrapper" class="floatright pad12l clearfix">
<img src="http://s25.postimg.org/j53rsobun/flowering_coffee_plant1.jpg" alt="Flowering Coffee Plant" class="boxshadowimg" />
</div>
<p>ed 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 </p>
CSS
p:before {
content: "";
width: 10em;
display: block;
overflow: hidden;
}
.floatright {
float:right;
}
.pad12l {
padding-left:12px;
}
.clearfix:before,
.clearfix:after {
content: '\0020';
display: block;
overflow: hidden;
visibility: hidden;
width: 0;
height: 0; }
.clearfix:after {
clear: both; }
.clearfix {
zoom: 1; }
/* min320 x max480 Gen Smartphones/Nexus S (portrait and landscape) */
@media only screen and (min-width:320px) and (max-width:480px) {
#image-wrapper{
float: none !important;
}
#image-wrapper img{
max-width: 80%;
display: block;
margin: 0 auto;
}
}