Css 如何集中包含UL的子div?
我正在建立一个页脚,但我有麻烦得到4个分区,其中包含链接到不同的页面集中。在dreamweaver上,它的行为是正确的,但只要我上传它或在JSFIDLE上测试它,它就会被分散 理想情况下,我希望它看起来像这样,每个div在页脚中“居中”:Css 如何集中包含UL的子div?,css,html,footer,Css,Html,Footer,我正在建立一个页脚,但我有麻烦得到4个分区,其中包含链接到不同的页面集中。在dreamweaver上,它的行为是正确的,但只要我上传它或在JSFIDLE上测试它,它就会被分散 理想情况下,我希望它看起来像这样,每个div在页脚中“居中”: Random information above the divs below (displayed center of footer) Product Company Etc....
Random information above the divs below (displayed center of footer)
Product Company Etc.... Contact
link link
link link
等等
我这里有一个演示,它有完整的代码:
以下是一些CSS:
/*global footer settings*/
#footer {
color: #C9C9C9;
min-width: 1500px;
background-color: #2d2d2d;
list-style: none;
height: 450px;
background-image:url(../img/index/footer/pixelpatterns.png);
background-repeat:repeat;
}
#insidefooter {
margin-top: 20px;
text-align: center;
}
/*settings for social media buttons*/
#insidefootertermsplusbuttons li {
display: inline;
color: #C9C9C9;
}
#insidefooterone h5, #insidefootertwo h5, #insidefooterthree h5, #insidefooterfour h5 {
text-align:left;
margin-bottom: 0;
color:#FFFFFF;
}
#insidefooterone ul, #insidefootertwo ul, #insidefooterthree ul, #insidefooterfour ul{
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
}
#insidefooterone li, #insidefootertwo li, #insidefooterthree li, #insidefooterfour li {
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
}
#disclaimer {
margin-top: 20px;
font-size: 9px;
text-align: center;
margin-bottom: 0;
}
#disclaimer p {
text-align:center;
color: #C9C9C9;
}
谢谢尝试将
填充:0
添加到ul
#insidefooterone ul, #insidefootertwo ul, #insidefooterthree ul, #insidefooterfour ul{
list-style: none;
text-align: left;
margin-left: 0;
color: #C9C9C9;
padding:0
}
不要根据dreamweaver设计视图判断输出。始终希望签入浏览器
您需要使用
margin:0 auto
使div中心对齐<代码>边距:0自动与浮动:左
没有任何区别。因此需要从父div中删除float:left
并尝试将父div添加到ul
链接中,以便于对齐。
只是一个简短的评论,不要相信Dreamweaver的设计视图。永远都不会。我相信你想要这样的东西:@Ruddy lesson是从艰苦的道路上学到的@ben_dchost当我开始web开发时,我做了完全相同的事情@阿第兹,这就是我想要的头球和分区的排列方式。但是如何使div位于页脚的中央,而不是左侧?谢谢您的回复。这就解决了其中一个问题,但是如何集中页脚中的div呢?实际上,代码中有很多修改。已经用新的演示更新了answe,希望您能够识别更改。