当前位置 : 主页 > 网页制作 > html >

基础HTML

来源:互联网 收集:自由互联 发布时间:2021-06-12
Tags opening or closing, are surrounded by angle brackets "self-closing tags" or "void tags",input/ (input仍然可用) Common Types of Tags h1 , h2 , h3 , h4 , h5 , and h6 – Headings. p – Paragraph. a – Anchor. div – Short for di

Tags

  • opening or closing, are surrounded by angle brackets
  • "self-closing tags" or "void tags",<input/> (<input>仍然可用)

Common Types of Tags

  • h1h2h3h4h5, and h6 – Headings.
  • p – Paragraph.
  • a – Anchor.
  • div – Short for division.
  • span – A container for small pieces of text.
  • olul, and li – Both ol and ul represent lists. 
  • button
  • img – An image.
  • input – Browser inputs.
  • textarea – Similar to an input but for a lot more text.
  • select and option
  • form – A group of html tags related to gathering data from a user.
  • tabletr, and td – Like making a table in Word or Excel. 

Comments

<!-- your comments go here -->

Attributes

Classes

special attributes that can go on any tag

kebab-case, HTML大小写不敏感。

IDs

IDs are far less useful than classes. Whereas you‘ll be using classes everywhere and frequently, you should be using IDs very sparingly.

When you designate something with an ID, you‘re affirming that this is the only one of those on your website. Not even just that page, but your whole website. 

Naming and Tags to Use: Semantic

in computer science that there are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. 

article, section, nav, header...

red-title 不是好的类名,如果标题后来要改成绿色呢?描述这个物件做什么而不是他的外观,比如 blog-post-title 或者 post-head。

Meta HTML

<!DOCTYPE html>
<html lang="en">
<head>
  <title>My amazing HTML Document</title>
</head>
<body>
  <h1>Check this out</h1>
  <!-- Your amazing HTML here -->
</body>
</html>

另外,还有:<script></script><style></style>, and <link />

网友评论