测验:HTML是否仍应出现在你的简历中?
证明你自己!
所以,你觉得你掌握了 HTML5 技能吗?
毕竟,你分得清 <div> 和 <span> 吧?但你对 HTML5 中更高级的语义元素了解多少呢?
提示:如果你无法通过这个测试,你必须从简历中删除「HTML 技能」。
开始吧!
何时应该使用 <figure> 和 <figcaption> 元素?
<figure> 标签通常用于包裹自包含的(媒体)内容,比如图片或图表,并使用 <figcaption> 提供标题。
这对于图片、图表、代码片段等非常有用。
<figure><img src="../image.jpg" alt="Description of image"><figcaption>Image caption</figcaption></figure>HTML 中 <article> 元素的用途是什么?
HTML5 的 <article> 元素 用于定义可以独立分发或重复使用的内容模块。
常用于博客文章、新闻稿、论坛帖子或用户评论等场景。
页面中可以包含多个 article 元素(比如无限滚动页面),也可以嵌套使用来构建”独立内容”的层级结构。
<article><h2>Article Title</h2><p>Article content...</p><article class="discussion"><h3>Comment by User</h3><p>Comment content...</p></article></article>表单中<fieldset>和<legend>元素的作用是什么?
<fieldset>用于分组相关表单控件,<legend>为该分组提供标题/标签,提升可访问性。
这对分组相关表单元素很有用,比如送货地址或支付详情部分。
<fieldset><legend>Shipping Address</legend><label for="name">Name:</label><input type="text" id="name" name="name">...</fieldset><fieldset><legend>Payment Details</legend><label for="card">Card Number:</label><input type="text" id="card" name="card">...</fieldset><meter> 元素的用途是什么?
<meter> 元素 用于表示在设定范围内标量(单一)的测量值,例如温度、磁盘使用率或投票统计。
它可能看起来与 <progress> 进度条类似,但进度条始终从零开始。因此 <progress> 元素显示的是“完成百分比”,而 <meter> 显示的是可定义范围内的任意值。
<meter min="-60" max="130" value="75" /> 75°F<meter min="0" max="100" value="75" /> 75%ARIA 属性的作用是什么?
ARIA(Accessible Rich Internet Applications)属性通过为屏幕阅读器和其他辅助技术提供额外上下文来增强网页可访问性。
有角色(roles)、状态(states)和属性(properties)可用于描述元素。
<button aria-label="Close" aria-expanded="true">X</button><main aria-live="polite">...</main><dialogrole="alertdialog"aria-modal="true"aria-labelledby="dialog_label"aria-describedby="dialog_desc"></dialog>那么,你做得如何?准备好在下一个项目中使用更多语义HTML元素了吗?🚀
还是打算一辈子都用<div>和<span>?😅
在评论区告诉我吧!👇