Structure and commonly used tags of an HTML document

1, the structure of an HTML document

<!DOCTYPE html>  # 声明此文档为HTML文档
<html lang="zh-CN">  # 此文档的开始标记。内部分文档头head 和正文body两部分
<head>  # 文档头的开始标记。内部放(文档设置参数的)标签,文档头内部的内容不会显示
  <meta charset="UTF-8">
  <title>css样式优先级</title>
</head>  # 文档头的结束标记
<body>  # 文档正文的开始标记,内部放(设置文档正文d的格式的)标签

</body>  # 文档正文的结束标记
</html>  # 此文档的结束标记

2, HTML tag classification

HTML tags are keywords that angle brackets and a pair of internal composition should generally have two properties, a unique id and inheritable class

2.1, according to the structure and form of a single-label points ditag

Single-label as


The ditag,

2.2, according to the display pattern within the block-level row labels and tags

Block-level tags: exclusive line like h1 ~ h6, p, br, hr, div and other labels, the label is a special case where p (block-level tags can not contain labels and p)

Inline tags: how to account for much internal text, such as a, img, s, b, u, i, span

3, HTML tags used

3.1, the head common tag

meta tags: specify meta-information such as coding type, jump URLs, rendering mode

title tag: Define page title

Pattern corresponding content is defined inside the body: style tag

script tag: introducing external code or custom JS JS files

link Tags: style file or import external website icon

3.2, within the body commonly used tags

b bold; I italic; underline U; S deleted;

p paragraph tag;

h1-h6 heading levels (title set level 1-6)

br Wrap

hr horizontal line (divided)

3.3, for example commonly used tags

div tag: is used to define a block-level element, there is no practical significance

span is: used to define the inline (inner line) elements, no practical significance

Difference block elements of the inner row of elements:
block element is a separate line start rendering elements, the elements are not subject to the line from the line. If a separate insert these two elements in a web page, will not have any impact on the page.
These two elements are defined specifically for the CSS style born.

img tag

<img src="图片的路径" alt="图片未加载成功时的提示" title="鼠标悬浮时提示信息" width="宽" height="高(宽高两个属性只用一个会自动等比缩放)">

a label: Hyperlink Label

Refers to the so-called hyperlinks pointing to a goal from a web connection relationship, this goal can be another Web page, it can be a different location on the same page, it can also be a picture, an email address, a file, or even It is an application.

<a href="http://www.oldboyedu.com" target="_blank" >点击跳转</a>

href attribute: specifies the landing page address. The address can be of several types:

  • Absolute URL - points to another site (such as = href " http://www.jd.com )

  • Relative URL - refers to the current site in the exact path (href = "index.htm")

  • Anchor URL - points to a page anchor (href = "# top")

    The target property:

    • _blank means open landing page in a new tab
    • _self means to open the landing page in the current tab

List Tags:

1, unordered list:

<ul type="disc">
  <li>第一项</li>
  <li>第二项</li>
</ul>

property type:

  • disc (solid circles, the default value)
  • circle (open circles)
  • square (solid squares)
  • none (no style)

2, an ordered list

<ol type="1" start="2">
  <li>第一项</li>
  <li>第二项</li>
</ol>

property type:

  • A list of numbers, the default value
  • A capital letter
  • a lowercase letters
  • Ⅰ capital Rome
  • Ⅰ lowercase Roman

3, the title list

<dl>
  <dt>标题1</dt>
  <dd>内容1</dd>
  <dt>标题2</dt>
  <dd>内容1</dd>
  <dd>内容2</dd>
</dl>

form:

General form for displaying data

The basic structure of the table:

<body>
    <table>
      <thead>
      <tr>
        <th>名次</th>
        <th>姓名</th>
        <th>班级</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>1</td>
        <td>allen</td>
        <td>三2班</td>
      </tr>
      <tr>
        <td>2</td>
        <td>Tom</td>
        <td>三1班</td>
      </tr>
      </tbody>
    </table>
</body>   

Attributes:

  • border: table border.
  • cellpadding: padding
  • cellspacing: margins.
  • width: percentage of pixels (length and width is preferably set by css).
  • rowspan: How much vertical cross-cell line
  • colspan: how many columns the cell spans (that is, merged cells)

Guess you like

Origin www.cnblogs.com/allenchen168/p/11861036.html