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

第 17 期(W3C标准-HTML):ol标签计数器 #20

Open
wingmeng opened this issue May 26, 2019 · 0 comments
Open

第 17 期(W3C标准-HTML):ol标签计数器 #20

wingmeng opened this issue May 26, 2019 · 0 comments

Comments

@wingmeng
Copy link
Collaborator

wingmeng commented May 26, 2019

题目:

已知有如下 HTML 结构:

<ol>
  <li>第 1 项</li>
  <li>第 2 项</li>
  <li>第 3 项</li>
  <li>第 4 项</li>
</ol>

默认情况下会渲染出一个从1到4的数字序号列表,如将列表第 2 项的 style 设置为 display: none,则其后面的序号是否会变动?如换成设为 visibility: hidden 呢?为什么?


参考答案:
应用 display: none 的元素不可见、不占据空间、辅助设备无法访问,而且该元素不会被渲染,所以计数器自动跳过第二项,第二项后面的序号从 2 开始递增。
应用 visibility: hidden 的元素虽然在视觉上不可见,但依旧占据布局空间,其计数器仍在运行,不会影响计数器的计数。

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

1 participant