html - 当@media screen and (max-width : 360px) it should be at center

标签 html css

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>

link

最佳答案

只需将 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/

相关文章:

css - 相同大小的子 Div

css - 如何替换 Divio Cloud 元素中的样式表?

javascript - 没有互联网,Bootstrap 无法工作

javascript - 如何使用 jQuery 在电子邮件验证上的按键上添加另一个语句

javascript - 如何制作一个模态框来显示完整的 php 页面?

javascript - 脚本或 CSS 加粗所有大写的单词

android - Android 中没有 css 标签的文本

css - 2个div高度合并在一起

css - Chrome 72 是否破坏了 css 背景 svgs 的 'data:image/svg+xml;utf8'?

javascript - jQuery 中 IMG URL 文件夹位置的拇指旋转器