境界線が横に伸びた見出しがあります (Chris Coyiers の例に触発されました)。境界線をグラデーションの背景に重ねてフェードアウトしようとしています。しかし、私はそれを機能させることはできませんが、何とかできるはずだと感じています。私が探している効果を説明するには:
これは私が今持っているものです:
そして、これは私が達成しようとしているものです:
私が今持っているコード:
HTML
<article>
<p>Lorem ipsum etc.</p>
<p class="fancy">
<a href="#">read more</a>
</p>
</article>
CSS
body {
background: red; /* Just to show the effect of the transparency, the final background will be white */
font-size: 150%;
}
/* This is for the horizontal borders extending sideways from the heading */
.fancy a {
max-width: 100%;
margin: 0 auto;
overflow: hidden;
display: block;
color: black;
text-align: center;
text-decoration: none;
font-family:'Bitter', serif;
font-style: italic;
font-size: 16px;
line-height: 32px;
}
.fancy a:before, .fancy a:after {
content:"";
display: inline-block;
position: relative;
height: .1em;
width: 50%;
border-top: 1px dotted black;
border-bottom: 1px dotted black;
margin-bottom: .25em;
}
.fancy a:before {
right: .5em;
margin-left: -50%;
}
.fancy a:after {
left: .5em;
margin-right: -50%;
}
/* This is the gradient I want to display in front of the border. The body will have a white background, so it will look like the border is fading out */
.fancy {
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
/* Firefox 3.6+ */
background: -moz-linear-gradient(left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
/* IE 10 */
background: -ms-linear-gradient(left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
/* Opera 11.10+ */
background: -o-linear-gradient(left, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}
簡単にいじるために、コードはここにあります: http://jsfiddle.net/QEdxe/3/
誰もこれを行う方法を知っていますか? 私はすでに絶対配置とz-indexを試しましたが、グラデーションを点線の境界線に重ねることはできません..