考虑这个小提琴:http: //jsfiddle.net/qkAJD/
HTML
<div style="width:500px;">
     <h1 class="success-header" title="Success!">Success!</h1>
</div>
CSS
body {
    background: gray;
    margin:0;
}
.success-header {
    color: green;
    display: inline-block;
    font-size: 50px;
    height: 50px;
    margin: 0;
}
.success-header:before {
    content: attr(title);
    position:absolute;
    color:rgba(255, 255, 255, 0.3);
    top:1px;
    left:1px;
}
结果

问题
我们如何才能让<h1>标签在其容器中居中,并且仍然保持凸版效果?假设我们事先并不知道容器的宽度是 500px。也就是说,硬编码标题位置的解决方案是不可接受的。将标题居中很容易:
<div style="width:500px;text-align:center">
     <h1 class="success-header" title="Success!">Success!</h1>
</div>
但这破坏了凸版效果:
