gpt4 book ai didi

CSS : Is it possible to have a gradient background on the selection pseudo element?

转载 作者:太空宇宙 更新时间:2023-11-04 01:47:01 25 4
gpt4 key购买 nike

我正在尝试向选择伪元素添加渐变背景。到目前为止,我已经尝试了这段代码,它只是返回一个白色背景。

    ::-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 属性不在上述列表中,所以根据规范这是不可能的。

关于CSS : Is it possible to have a gradient background on the selection pseudo element?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44293538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com