HTML入门笔记

77 阅读1分钟

1. HTML 是谁发明的

Tim Berners-Lee,蒂姆·伯纳斯·李

2. HTML 起手应该写什么

<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>标题</title>
  </head>
  <body></body>
</html>

通过“!+tab”可以便捷生成,一般情况下,修改charset="zh-CN"即可

3. 常用的表章节的标签有哪些,分别是什么意思(h1~h6、section、article、main、aside 等等)

  • h1~h6:标题
  • section:章节
  • article:文章
  • p: 段落
  • header: 头部
  • main:主体
  • footer:脚步
  • aside:旁支内容
  • div: 划分

4. 默认样式

      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
      button,
      input,
      select,
      textarea {
        font: inherit;
      }
      *::after,
      *::before {
        box-sizing: border-box;
      }
      h1,
      h2,
      h3,
      h4,
      h5,
      h6 {
        font-weight: normal;
      }
      a {
        color: inherit;
        text-decoration: none;
      }
      ul,
      ol {
        list-style: none;
      }
      table {
        border-collapse: collapse;
        border-spacing: 0;
      }
    </style>

5. 全局属性有哪些

  • class:用作元素的类名,一般通过class给元素设置样式
  • id:用作元素的唯一id标识,不到万不得已别使用id选择器给元素添加样式
  • contenteditable:规定是否可编辑元素的内容
  • tabindex:设置元素的控制次序,0表示最后被访问,-1表示该元素不能被访问
  • style:给元素设置行内样式,优先级最高
  • title:给元素设置的额外信息,鼠标放在元素上可以看见描述
  • hidden:对元素进行隐藏

6. 常用的内容标签有哪些,分别是什么意思(a、strong、em、code、pre 等等)

  • a:超链接标签,可以通过设置href属性,点击标签跳转页面,target="_blank"表示在新页面打开网页
  • strong:表示内容本身的重要性
  • em:em 表示语气上的强调
  • code:对文档中的文本进行格式化,code标签里面的字体是等宽的
  • pre:被包围在pre标签中的文本会保留空格和回车,文本字体也是等宽的
  • dl + dt + dd : 描述列表