我有一个正在构建的页脚。
我希望能够将页脚中的 4 个 div 居中(例如第一段或 5 个图标(无法呈现))。执行此操作的最佳方法是什么?
演示:http://jsfiddle.net/8q5ek/3/
CSS:
#insidefooter, #disclaimer {
max-width: 960px;
min-width: 960px;
margin-left: 25%;
margin-right: auto;
}
#footer {
color: #C9C9C9;
min-width: 1500px;
background-color: #2d2d2d;
list-style: none;
height: 450px;
background-image:url(http://i.imgur.com/yb7j6PD.png);
background-repeat:repeat;
}
#insidefooter {
margin-top: 20px;
text-align: center;
}
/*settings for social media buttons*/
#insidefootertermsplusbuttons li {
display: inline;
color: #C9C9C9;
}
#insidefooterone1 h5, #insidefootertwo1 h5, #insidefooterthree1 h5, #insidefooterfour1 h5 {
text-align:left;
margin-bottom: 0;
padding-bottom: 0;
color:#FFFFFF;
padding-left: 0px;
}
#insidefooterone1 li, #insidefootertwo1 li, #insidefooterthree1 li, #insidefooterfour1 li {
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
padding: 0;
}
#insidefooterone1 ul, #insidefootertwo1 ul, #insidefooterthree1 ul, #insidefooterfour1 ul {
list-style: none;
text-align: left;
padding-left: 0px;
padding-right: 0;
color: #C9C9C9;
overflow: hidden;
}
#disclaimer {
margin-top: 20px;
font-size: 9px;
text-align: center;
margin-bottom: 0;
}
#disclaimer p {
text-align:center;
color: #C9C9C9;
}
.ul_links {
overflow: auto;
display: inline-block;
min-width: 700px;
}
最佳答案
我解决了你的问题。 所以我反复研究了您的代码,做了很多更改,结果如下:
实际的技巧是使用 display: inline-block;
和 margin-left: auto; margin-right: auto;
以及我更改的其他一些内容,正如您从 jsfiddle 中看到的那样。 ;)
问候
关于html - 如何在DIV中居中DIV?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23358790/