how to center the div content in float right div when it is text-align:left
<html><head></head><body>
<div class="top">top</div>
<div class="fleft"></div>
<div class="fright">
<h1>this is heading</h1>
<p>* test 1test 1test 1 </p>
<p>* test 1test 1test 1 </p>
<p>* test 1test 1test 1 </p>
<p>* test 1test 1test 1 </p>
</div>
</body>
</html>
最佳答案
只需将 text-align:center 添加到您的媒体查询中
@media screen and (max-width : 360px) {
.top{width: 100%;}
.fleft{width: 100%;}
.fright {
width:100%;
text-align:center;
}
}
http://jsfiddle.net/wilsoda/4yv8emm1/
如果您希望内容环绕居中但文本左对齐,只需添加 Inner div 即可。
@media screen and (max-width : 360px) {
.top {
width: 100%;
}
.fleft {
width: 100%;
}
.fright {
width:100%;
}
.inner {
width:70%;
margin:0 auto;
}
}
http://jsfiddle.net/wilsoda/5g2ccd4p/
希望对您有所帮助!
关于html - 当@media screen and (max-width : 360px) it should be at center,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25327187/