Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有一些我看到的是错误的答案,在这里提出更正 #19

Open
MirrorYan opened this issue Mar 15, 2021 · 1 comment
Open

Comments

@MirrorYan
Copy link

CSS 部分问题与解答中

6. 在HTML文本中,伪类:root总是指向html元素?

这题的答案是正确的,这道题的前提是 “在HTML文本中”,HTML文本中的 root 总是指向 html 元素的。
在W3C中有明确的说明 : 请戳这里查看 CSS3 :root 选择器

14. 如下代码中文本“Sausage”的颜色是?

<ul class="shopping-list" id="awesome">
    <li><span>Milk</span></li>
    <li class="favorite" id="must-buy"><span class="highlight">Sausage</span></li>
</ul>
#awesome .favorite:not(#awesome) .highlight {
    color: red;
}
#awesome .highlight:nth-of-type(1):nth-last-of-type(1) {
    color: blue;
}

这里考察的是对CSS选择器优先级的掌握,答案应该是 red

18. mypic.jpg 会被浏览器加载吗?

<div id="test1">
    <span id="test2"></span>
</div>
#test1 {
    display: none;
}
#test2 {
    background-image: url('mypic.jpg');
    visibility: hidden;
}

答案是 会被加载。这里考察的是CSS样式对背景图加载的影响,visibility: hidden 只是不显示,节点在文本流中仍然占有一席之位,背景图仍然会被加载。

@Webming19
Copy link

关于18的问题,验证过后,确实不会被加载,因为test1的display为none,导致整个元素不被加载,看浏览器的NetWork就会发现这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants