gpt4 book ai didi

jquery - 如何使用JQuery识别CSS 'text-decoration'

转载 作者:行者123 更新时间:2023-12-01 02:42:40 26 4
gpt4 key购买 nike

一个听起来相当明显的答案,正如您认为答案是这样的:

$(theelement).css('text-decoration');

其中“theelement”是实际涉及的元素(使用 jqueryCSS )。

我的问题是,每当我尝试这样做时,它总是返回以下格式的内容:

none solid rgb(0, 0, 0)

它看起来非常像边框 CSS,而不是文本装饰 CSS。

我将其放入 fiddle 中以简单的方式演示这一点:click for this JSFiddle

感谢您的帮助!

最佳答案

来自MDN :

Note: CSS Text Decoration Level 3 transformed this property as a shorthand for the three new text-decoration-color, text-decoration-line, and text-decoration-style CSS properties.

因此,当您读取该属性时,您将获得所有三个组件属性。如果您不想要所有三个属性,请指定您想要的属性,例如

$(theelement).css('text-decoration-line')

将返回

关于jquery - 如何使用JQuery识别CSS 'text-decoration',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22474043/

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