2
我學習的background-attachment
CSS屬性,但由於某些原因,它不會顯示在文本區域的,圖像等背景附件CSS屬性不會隨顯示不同的HTML元素
這裏是我的HTML:
<div class="scrollbox">
<ul>
<li>Ah! Scroll below!</li>
<li>
<textarea rows="6" cols="50"></textarea>
</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>1</li>
<li>2</li>
<li>3</li>
<li>The end!</li>
<li>No shadow there.</li>
</ul>
</div>
這裏是我的CSS:
.scrollbox {
overflow: auto;
width: 500px;
max-height: 500px;
margin: 50px auto;
background:
/* Shadow covers */
linear-gradient(white 30%, rgba(255,255,255,0)),
linear-gradient(rgba(255,255,255,0), white 70%) 0 100%,
/* Shadows */
radial-gradient(50% 0, farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)),
radial-gradient(50% 100%,farthest-side, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
background:
/* Shadow covers */
linear-gradient(white 30%, rgba(255,255,255,0)),
linear-gradient(rgba(255,255,255,0), white 70%) 0 100%,
/* Shadows */
radial-gradient(farthest-side at 50% 0, rgba(0,0,0,.2), rgba(0,0,0,0)),
radial-gradient(farthest-side at 50% 100%, rgba(0,0,0,.2), rgba(0,0,0,0)) 0 100%;
background-repeat: no-repeat;
background-color: white;
background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
/* Opera doesn't support this in the shorthand */
background-attachment: local, local, scroll, scroll;
}
你的CSS是否被包含在頁面中('html.head.meta'標籤)? –
@ColeJohnson,你可以使用http://jsbin.com/ – Patrioticcow
錯誤:.scrollbox \t值錯誤:背景最遠端不是顏色值),徑向梯度(50%100%,最遠端,rgba( 0,0,0,.2),rgba(0,0,0,0))0 100% –