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

HTML 语义化 #9

Open
xrkffgg opened this issue Jan 19, 2021 · 0 comments
Open

HTML 语义化 #9

xrkffgg opened this issue Jan 19, 2021 · 0 comments
Labels

Comments

@xrkffgg
Copy link
Owner

xrkffgg commented Jan 19, 2021

建议

  • 少使用无意义的 <div>、<span> 标签
  • <label> 标签中设置 for 属性和对应的 <input> 关联起来
  • 设置 <img> 标签的 alt 属性,给 <a> 标签设置 title 属性
  • 在页面的标题部分使用 <h1>~<h6> 标签,不需要给它们加多余的样式
  • 与表单、有序列表、无序列表相关的标签不要单独使用

语义元素结构

image

  • <header> 标签通常放在页面或页面某个区域的顶部,用来设置页眉
  • <nav> 标签可以用来定义导航链接的集合,点击链接可以跳转到其他页面
  • <article> 标签中的内容比较独立,可以是一篇新闻报道,一篇博客,它可以独立于页面的其他内容进行阅读
  • <section> 标签表示页面中的一个区域,通常对页面进行分块或对内容进行分段,<section> 标签和 <article> 标签可以互相嵌套
  • <aside> 标签用来表示除页面主要内容之外的内容,比如侧边栏
  • <footer> 标签位于页面或页面某个区域的底部,用来设置页脚,通常包含版权信息,联系方式等
@xrkffgg xrkffgg added the html label Jan 19, 2021
@xrkffgg xrkffgg changed the title HTML 语义化建议 HTML 语义化 Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant