Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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
Html 水平居中页脚div_Html_Css_Center_Footer - Fatal编程技术网

Html 水平居中页脚div

Html 水平居中页脚div,html,css,center,footer,Html,Css,Center,Footer,页眉的顶部div居中,但由于某些原因,页脚中的内容没有居中。下面是页脚的css: div#footer { background-color: #000; color: #fff; position:relative; height:350px; clear: both; margin-left: auto; margin-right: auto; text-align: center; width: 100%; } 将这

页眉的顶部div居中,但由于某些原因,页脚中的内容没有居中。下面是页脚的css:

div#footer {
    background-color: #000;
    color: #fff;
    position:relative;
    height:350px;
    clear: both;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    width: 100%;
}

将这些规则应用于
中心
标记

overflow: auto;
display: inline-block;
顺便说一句,中间的标签已经过时了,直到现在我才看到它。但不管怎样


我喜欢整个网站…它显示出热情。

我建议您在
div#footer
中添加以下行:

overflow: auto;
display: inline-block;

定义所需的
宽度
,并给出如下
边距

div#footer {
      width: 500px;
      margin: 0 auto; /* or `10px auto` to add margin top and bottom */
      text-align: center; /* align text center aligned*/
}

是否应用到中心标记?我只是在footer.php中对它进行了标记,虽然我同意,但它没有做任何事情,它不是我的css文件的一部分,因为它是自己的标记。需要吗?您可以创建一个
,然后在css文件中添加
.center{…rules over…}
。。“中心标记包括所有页脚内容。@Kristin如果您最终使用的是此答案,请不要忘记将其标记为已接受(单击左侧的灰色复选标记)。”。谢谢