5

演示链接

不知道为什么我在第二个列表中的文本没有居中。

在此处输入图像描述

的HTML

<div id="the_target">
    <ul>
        <li>Stephen Marston</li>
        <li>Account Exectutive</li>
        <li>The Company</li>
    </ul>
</div>

萨斯:

section {
    #the_requestor {
        margin-top: 40px;
        ul { margin-top: 10px; }
        ul li {
            text-align: center;
            line-height: $px20;
        }
        li:first-child {
            font-family: LatoBold;
            font-size: $px30;
            background: cyan;
        }
    }
    #the_target {
        position: relative;
        margin-top: 40px;
        ul { margin-top: 10px; }
        ul li {
            text-align: center;
            line-height: $px20;
        }
        li:first-child{
            font-family: LatoBold;
            font-size: $px30;
            background: cyan;
        }
    }
}

关于什么可能迫使斯蒂芬马斯顿不居中的任何想法?

4

2 回答 2

5

有一个浮动元素正在#mobile-action-area干扰。您需要清除此浮动。有多种方法可以做到这一点。添加overflow: hidden#mobile-action-area修复它。您也可以尝试:

#mobile-action-area:after {
    display: table;
    content: "";
    clear: both;
}
于 2013-08-29T19:41:19.767 回答
2

您需要在 #the_target 之前清除浮动

   #the_target {
            position: relative;
            margin-top: 40px;
            clear:both;
    }
于 2013-08-29T19:44:29.220 回答