页面显示不适合屏幕

时间:2015-04-04 21:27:46

标签: css

任何人都可以帮助我,我创建了一个网站,我将以下大小放在页面上。

这是HTML ..

<html>
<body>
<div id="container" >
</div>
</body>
</html>

这是CSS

html {
    background:#333;
}

body {
    width:1280px;
    background:#fff;
    margin:0px auto;
}


#container {
    width:1100px;
    background:#fff;
    margin:0 auto;
}

问题是我在左侧有所需的准确要求保证金,但在右侧显示额外的保证金空间请告诉我如何解决这个问题以及为什么会发生这种情况?

1 个答案:

答案 0 :(得分:0)

您可以在CSS中使用定位来确定在页面上查看内容的位置。

您可以添加left:right:top:bottom:,以确定您希望内容在网页上的确切位置。

通过添加#container {margin-left:auto; margin-right:auto;}来集中容器也可以使内容居中。

通过将vertical-align:center添加到CSS类(或ID)中,也可以垂直居中。

希望这有帮助!