css3 - How to center images for small mobile that were floated on desktop -
i float images either left or right around text on desktop want them centered small mobile devices , paragraph drop below image using responsive design. i've got paragraph dropping below image using online mobile viewing device not when try view via computer. image won't center online or on computer.
here have found after many hours of research:
i have set images:
img{ border:0; max-width:100%; height:auto; } i have set paragraphs: pushes paragraph down below floated image when width of paragraph less 10em (about 200 px).
p:before{ content: ""; width: 10em; display: block; overflow: hidden; } i have applied following images media queries less 320 , max of 480:
img{ max-width:100%; display:block!important; margin:0 auto !important; float:none !important; } (i had add !important of them or wouldn't take it's still not accepting margin: 0 auto; )
can see i'm doing wrong?
here have working update of need: http://jsfiddle.net/ancpjmet/3/
i changed min-devide-width min-width , max-devide-width max-width able see changes on desktop browser in google chrome.
you have set div wrapping img float: none;, not img:
@media screen , (min-width:320px) , (max-width:480px) { #image-wrapper{ float: none !important; } #image-wrapper img{ max-width: 80%; display: block; margin: 0 auto; } } i rebuild .clearfix class more consistant , work in browsers:
.clearfix:before, .clearfix:after { content: '\0020'; display: block; overflow: hidden; visibility: hidden; width: 0; height: 0; } .clearfix:after { clear: both; } .clearfix { zoom: 1; } take @ changes in jsfiddle given.
Comments
Post a Comment