【发布时间】:2019-01-09 21:57:34
【问题描述】:
此问题发生在 Chrome 中,但不是 Safari。希望有解决办法。
滚动<div>,当元素具有线性渐变背景时,元素不会实时更新。它只会在您的鼠标离开 <div> 并返回时更新。
我希望<div> 中的背景在我滚动时会发生变化。背景渐变的高度应该大于 div 的高度,这样当您滚动时,您会看到更多的渐变。
这里是指向问题的 CodePen 的链接。 https://codepen.io/brady-brown/live/XoPKJZ
<div class="tipPageSearchButtons">
<div class="tipPageButtons" id="tipPageButtons">
<div class="tipButton">
TEST
</div>
<div class="tipButton">
New button
</div>
<div class="tipButton">
Another
</div>
<div class="tipButton">
Keeps going
</div>
<div class="tipButton">
cheers
</div>
<div class="tipButton">
this is a button
</div>
<div class="tipButton">
tips
</div>
</div>
.tipPageButtons {
position: relative;
display: flex;
flex-direction: column;
height: 200px;
width: 35%;
overflow-y: scroll;
box-shadow: 0px 0px 10px 0px gray;
border-radius: 4px;
background: -webkit-linear-gradient(top, #712EBD,#00A8C6);
background: linear-gradient(to bottom, #712EBD,#00A8C6);
background-attachment: local;
}
.tipButton {
display: flex;
flex: none;
align-items: center;
justify-content: center;
font-family: 'Roboto', sans-serif;
font-size: 12px;
text-transform: uppercase;
letter-spacing: 2.5px;
font-weight: 600;
height: 30px;
color: #FFF;
width: auto;
border: none;
padding: 6px 10px 6px 10px;
user-select: none;
}
.tipButton:hover {
border: 1px solid black;
}
.tipButton:active {
background: transparent;
}
【问题讨论】:
-
对我来说似乎没问题(在 chrome 上测试)
-
清除Chrome浏览器缓存,重试。它对我来说很好用,在 Chrome 中测试过。
标签: html css scroll background linear-gradients