div 元素中的背景线性渐变不实时变化
Background linear-gradient not changing real-time in div element
此问题出现在 Chrome 而不是 Safari。希望有解决办法。
滚动 <div>
,当元素具有线性渐变背景时,元素不会实时更新。它只会在您的鼠标离开 <div>
并返回时更新。
我希望 <div>
中的背景在滚动时发生变化。背景渐变的高度应大于 div 的高度,这样当您滚动时,您会看到更多的渐变。
这里是一个 link 到 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;
}
我用得很好。因此,我认为您需要从浏览器中清除缓存:转到 Inspect Element > Network > Disable Cashe 您可以轻松完成。
希望对您有所帮助
它对我来说很好用,在 Chrome 中测试过。在 chrome 的私人窗口中重新尝试 (Ctrl+Shift+N)
此问题出现在 Chrome 而不是 Safari。希望有解决办法。
滚动 <div>
,当元素具有线性渐变背景时,元素不会实时更新。它只会在您的鼠标离开 <div>
并返回时更新。
我希望 <div>
中的背景在滚动时发生变化。背景渐变的高度应大于 div 的高度,这样当您滚动时,您会看到更多的渐变。
这里是一个 link 到 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;
}
我用得很好。因此,我认为您需要从浏览器中清除缓存:转到 Inspect Element > Network > Disable Cashe 您可以轻松完成。 希望对您有所帮助
它对我来说很好用,在 Chrome 中测试过。在 chrome 的私人窗口中重新尝试 (Ctrl+Shift+N)