将方框阴影应用于h2时,它显示在块周围,而不是文本周围



HTML:

<div class="div1">
    <h2>Set RSVP & Check in</h2>
    <p>
        Set RSVP to remind all events you plan to go.
    </p>
</div>

CSS:

.div1 {
    float: left;
    margin: 0 20px 0 0;
    padding: 0;
    width: 300px;
    height: 156px;
}
.div1 h2 {
    color: #fff;
    font-size: 24px;
    font-weight:bold;
    box-shadow: 1px 1px 0 black;
}

边框看起来像"表格边框",而不是文本上的边框:

http://screencast.com/t/OrFfBL9MK

我认为您混淆了框阴影和文本阴影。

试试这个:

.div1 h2 {
    color: #fff;
    font-size: 24px;
    font-weight:bold;
    text-shadow: #000000 1px 1px 0px;
}

最新更新