【问题标题】:Why does the CSS of YouTube's comment section have two "line-height"s? [closed]为什么YouTube评论区的CSS有两个“line-height”? [关闭]
【发布时间】:2020-09-20 14:13:10
【问题描述】:

如果我打开一个像这样 (https://www.youtube.com/watch?v=Jmel5YySUXU) 的随机 YouTube 视频,并在开发者工具中检查评论的样式,我发现有两个 line-height,第一个被取消了。

如果我点击“inline:18451”,我会看到如下代码,但我在网页的源代码中找不到这个,所以我猜它是动态创建的。我的问题是为什么有两个 line-height 属性。这有什么意义吗,或者这只是一个错误(程序员忘记了第一个,后来又添加了第二个)?

#content-text.ytd-comment-renderer {
  --yt-endpoint-color: var(--yt-spec-call-to-action);
  --yt-endpoint-hover-color: var(--yt-spec-call-to-action);
  --yt-endpoint-visited-color: var(--yt-spec-call-to-action);
  color: var(--yt-spec-text-primary);
  font-size: var(--ytd-user-comment_-_font-size); font-weight: var(--ytd-user-comment_-_font-weight); line-height: var(--ytd-user-comment_-_line-height); letter-spacing: var(--ytd-user-comment_-_letter-spacing);
  line-height: 2rem;
}

【问题讨论】:

  • 只有 Youtube 可以回答你的问题...

标签: css youtube


【解决方案1】:

这可能只是一个错字。

后来有人试图解决问题,但没有注意到那里已经有一个 line-height 属性。

在同一个选择器中使用 CSS,最后提及的属性会覆盖之前的任何属性,当然除非他们使用 !important

从经验来看,人们往往会犯错误。

【讨论】:

    猜你喜欢
    • 2012-08-03
    • 1970-01-01
    • 2015-03-03
    • 2017-06-19
    • 2013-01-08
    • 2014-06-11
    • 1970-01-01
    • 1970-01-01
    • 2018-07-09
    相关资源
    最近更新 更多