我的網站是http://tracebaxter.com,我有一個線性漸變模仿標題充當文字陰影。每次我第一次加載頁面時,所有的漸變都使用最後一個標題,我必須重新加載頁面才能正確。這是什麼造成的。 我的CSSCSS線性漸變顯示錯誤的詞
h2,h2:after {
margin: 0;
padding: 0;
box-sizing: border-box;
position: relative;
}
.content {
margin-left: 20%;
}
.header {
text-decoration: none;
color: black;
}
h2 {
display: inline-block;
color: #4d4235;
font-family: 'Righteous', serif;
font-size: 6em;
text-shadow: .03em .03em 0 gray;
width: 100%;
}
h2:after {
content: attr(data-shadow);
position: absolute;
z-index: -1;
top: .06em; left: .06em;
text-shadow: none;
background-image:
-webkit-linear-gradient(left top, transparent 0%, transparent 25%, #555 25%, #555 50%, transparent 50%, transparent 75%, #555 75%);
background-size: .05em .05em;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: shad-anim 12s linear infinite;
}
@keyframes shad-anim {
0% {background-position: 0 0}
0% {background-position: 100% -100%}
}
<h2 id="about" class="dashed-shadow" data-shadow="About">About</h2>
你是什麼意思,他們使用的是最後一個標題?包括第一次加載時,所有漸變都與文本相匹配。 – Britni