2014-09-21 70 views
0

我的页面这样的事情了:文字阴影略低于文本

<h1 class="page-header">Some text</h1> 

和CSS是:

font-size: 60px; 
text-transform: uppercase; 
text-align: center; 
color: #61430c; 
font-weight: 700; 
margin: 0 0 100px; 
white-space: nowrap; 
overflow: hidden; 
text-overflow: ellipsis; 
background: -webkit-linear-gradient(-89deg, #7D570F 38%, #452E00 56%); 
-webkit-background-clip: text; 
-webkit-text-fill-color: transparent; 

是否有可能添加文本下有阴影只是看起来像简单的所迷离线?谢谢。

+0

确实[文字阴影(https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow)属性你不胜任这项工作? – Harry 2014-09-21 11:24:15

+1

@Harry,而不是-webkit-text-fill-color。 – Shomz 2014-09-21 11:34:15

+0

有问题,我需要像“简单的模糊规则”像阴影更像盒子影子 – Geril 2014-09-21 11:37:06

回答

0

你不会轻易实现这一点。我的建议是使用::after伪元素在文本下面添加模糊的椭圆/椭圆(这里是Fiddle)。

.page-header::after { 
    content: ''; 
    display: block; 
    width: 383px; 
    height: 6px; 
    background: rgba(0,0,0,.1); 
    box-shadow: rgba(0,0,0,.1) 0px 0px 7px; 
    -moz-border-radius: 100px/50px; 
    -webkit-border-radius: 100px/50px; 
    border-radius: 400px/10px; 
    margin: 0 auto; 
    position: relative; 
    bottom: 17px; 
} 

.page-header { 
    font-size: 60px; 
    text-transform: uppercase; 
    text-align: center; 
    color: #61430c; 
    font-weight: 700; 
    margin: 0 0 100px; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
    background: -webkit-linear-gradient(-89deg, #7D570F 38%, #452E00 56%); 
    -webkit-background-clip: text; 
    -webkit-text-fill-color: transparent; 
} 
+0

是的,这是真的不错的想法,我也在想它,但宽度有问题,这些标题将动态更改 – Geril 2014-09-21 12:46:18