Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css 如何使竞争与身体平等_Css_Html - Fatal编程技术网

Css 如何使竞争与身体平等

Css 如何使竞争与身体平等,css,html,Css,Html,我正在努力解决我的网站的一个问题 我想使与宽度为960px的主体相等。我的代码中有什么错误或缺失?对不起,我不能直接在这里发布代码,这是不允许的。以下是我的文件链接: 这是解决方案,为id“#content”和class.Project1”编写CSS,如下所示: #content { width: auto; overflow: hidden; } .Project1 { width: auto; float: left; margin-right: 3

我正在努力解决我的网站的一个问题

我想使
与宽度为
960px
的主体相等。我的代码中有什么错误或缺失?对不起,我不能直接在这里发布代码,这是不允许的。以下是我的文件链接:


这是解决方案,为id“#content”和class.Project1”编写CSS,如下所示:

#content {
    width: auto;
    overflow: hidden;
}

.Project1 {
    width: auto;
    float: left;
    margin-right: 30px;
}
body {
    width: 960px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}
此外,您还可以通过编写如下CSS将身体元素居中:

#content {
    width: auto;
    overflow: hidden;
}

.Project1 {
    width: auto;
    float: left;
    margin-right: 30px;
}
body {
    width: 960px;
    margin-left: auto;
    margin-right: auto;
    display: block;
}

你能为你的代码提供一个代码笔,这样我们就可以看到它了吗?如果您知道您的身体宽度为960,则可以将高度设置为960。如果您需要它来响应,您可能可以使用height:100vw(vw=视口宽度),或者如果您想拥有更大的内容,可以使用minheight。