指定body的CSS宽度是否安全? [英] specified body CSS width is safe?

查看:104
本文介绍了指定body的CSS宽度是否安全?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在经常以一定大小为中心的内容。

Now very often content with a certain size centered.

<html>
<head>
  <style type="text/css">
    #content { margin: auto; width: 960px;}
  </style>
</head>
<body>
   <div id="content">Blah!</div>
</body>
</html>

可以安全地不使用包装器对齐和大小,并将其直接应用于 body 标记? 像这样

Is it safe to not use a wrapper for alignment and size, and apply it directly to a body tag? Like this:

<html>
<head>
   <style type="text/css">
      body { margin: auto; width: 960px;}
   </style>
</head>
<body>
   Blah
</body>
</html>


推荐答案

大小是安全的,

您必须添加 text-align:center 到body风格中心它在IE6中。 (是的,我知道,这完全没有意义,但这是锄IE6工程)

You have to add text-align: center to the body style to center it in IE6, too. (Yeah, I know, it totally makes no sense, but that’s hoe IE6 works)

这篇关于指定body的CSS宽度是否安全?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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