gpt4 book ai didi

css - 使用伪类时的问题

转载 作者:太空宇宙 更新时间:2023-11-04 13:02:02 24 4
gpt4 key购买 nike

我在阅读 时遇到了一些问题。在第 55 页,“ Real-world issues with dynamic styling”部分,作者举了一个例子:

a:link, a:visited {font-size: 13px;}
a:hover {font-size: 20px;}

并说:

However, the CSS specifications state that user agents are not required to redraw a document once it's been rendered for initial display, so you can't absolutely rely on your intended effect taking place. I strongly recommend that you avoid designs that depend on such behavior.

我还以为作者没有解释清楚呢。并且使用 javascript 实现这种行为更加复杂。为什么我不应该使用这样的伪类?

有没有人能告诉我这种行为在什么情况下会造成不良后果

最佳答案

当你的浏览器不支持伪类时,这些样式将被忽略。你仍然可以使用 js/jsquery。但是大多数现代浏览器现在都支持伪类。

关于css - 使用伪类时的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25377658/

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