文字没有正确居中?

时间:2014-01-13 17:53:13

标签: html css

我有我的社交菜单text-aligned:center,但它仍然有很多方法。这是我的代码和jsfiddle来演示麻烦。正如您所看到的,它左侧比右侧有更多的开放空间。我想把它弄出来。

jsfiddle

HTML

<div id="wrapper">
    <div id="header">
        Erratic Fox
    </div>
    <div id="social">
    <ul>
        <li><a href="http://facebook.com/erraticfox">Facebook</a></li> —
        <li><a href="http://erratic-fox.deviantart.com">Deviant Art</a></li> —
        <li><a href="http://youtube.com/erraticfox">YouTube</a></li> —
        <li><a href="http://steamcommunity.com/id/erraticfox">Steam</a></li>
    </ul>

    </div>
</div>

CSS

body {
    margin-top: 10px;
    background-color: #E5E5E5;
}

#header {
    color: #404040;
    width: 50%;
    margin: auto;
    background-color: #ffffff;
    font-size:100px;
    text-align: center;
}

#social {
    font-family: Roboto;
    font-size: 18px;
    line-height: 100px;
    text-align: center;
    height: 100px;
    width: 50%;
    background-color: white;
    margin-left: auto;
    margin-right: auto;
    margin-top: 10px;
}

#social a {
    text-decoration: none;
    color: #404040;
    transition: 1s color;
    -moz-transition: 1s color;
    -webkit-transition: 1s color;
}

#social a:hover {
    color: #427FED;
    transition: 1s color;
    -moz-transition: 1s color;
    -webkit-transition: 1s color;
}

#social li {
    margin-right: 30px;
    margin-left: 30px;
    display: inline;
}

2 个答案:

答案 0 :(得分:2)

添加

#social ul {
  padding-left:0;
}

Demo

答案 1 :(得分:0)

尝试实施此目的:

ul { padding: 0; margin: 0; }
相关问题