中心网页内容 [英] Center contents of webpage

查看:150
本文介绍了中心网页内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要集中化我的网页的文本和内容。现在我不想将文本对齐到中心,我仍然想要一个左对齐,但我想要左右的显着边距,使一切看起来相对中心。你能告诉我HTML / CSS来实现这一点吗? THanks。

I want to "centerize" the text and contents of my webpage. Now I don't want to align the text to center, I still want a left alignment but I want significant margins on the left and right so that everything looks relatively center-ish. Can you show me the HTML/CSS to achieve this? THanks.

推荐答案

<html>
<head>
<style type="text/css">

body {
   text-align: center; /* Center in IE */
}

#content {
   text-align: left; /* reset text-align for IE */
   margin: 0 auto; /* Center in other browsers */
   width: 800px;
}

html {
   overflow: -moz-scrollbars-vertical; /* Force vertical scrollbar in FF */
}

</head>
<body>
<div id="content">

   content here

</div>
</body>
</html>

* UPDATE:我添加了一些CSS,强制在垂直滚动条如下面的一些注释。

*UPDATE: I added some CSS that forces a vertical scrollbar in FF as per some comments below.

这篇关于中心网页内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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