Html 水平居中页脚div
页眉的顶部div居中,但由于某些原因,页脚中的内容没有居中。下面是页脚的css: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#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如果您最终使用的是此答案,请不要忘记将其标记为已接受(单击左侧的灰色复选标记)。”。谢谢