我正在尝试向选择伪元素添加渐变背景。到目前为止,我已经尝试了这段代码,它只是返回一个白色背景。
::-moz-selection {
background: -moz-linear-gradient(-45deg, $degrade-min 0%, $degrade-max 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, $degrade-min 0%,$degrade-max 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(135deg, $degrade-min 0%,$degrade-max 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
color:white;
}
::selection {
background: -moz-linear-gradient(-45deg, $degrade-min 0%, $degrade-max 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(-45deg, $degrade-min 0%,$degrade-max 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(135deg, $degrade-min 0%,$degrade-max 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
color:white;
}
所以我想知道这是否不可能?
So i'm wondering if maybe that's just not possible ?
https://drafts.csswg.org/css-pseudo-4/#highlight-styling :
The following properties apply to the highlight pseudo-elements:
color
background-color
cursor
caret-color
outline
and its longhands
text-decoration
and its associated properties
text-emphasis-color
text-shadow
由于渐变在 CSS 中被视为 图像,答案是:否,因为 background-image
属性不在上述列表中,所以根据规范这是不可能的。
我是一名优秀的程序员,十分优秀!