如何对齐< D​​IV>到页面的中间(水平/宽度) [英] How to align a <div> to the middle (horizontally/width) of the page

查看:264
本文介绍了如何对齐< D​​IV>到页面的中间(水平/宽度)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和宽度设置为800px div标签。当浏览器宽度大于800px,它不应该伸展股利但应该把它带到所述页的中间

解决方案

 <身体GT;
    < D​​IV的风格=宽度:800px;保证金:0汽车;>
        中心内容
    < / DIV>
< /身体GT;
 

I have a div tag with width set to 800px. When the browser width is greater than 800px, it shouldn't stretch the div but it should bring it to the middle of the page.

解决方案

<body>
    <div style="width:800px; margin:0 auto;">
        centered content
    </div>
</body>

这篇关于如何对齐&LT; D​​IV&GT;到页面的中间(水平/宽度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆