HTML Heading & Paragraph & Formatting

来源:互联网 发布:linux 递归创建目录 编辑:程序博客网 时间:2024/06/04 11:20

Headings

Headings are defined with the <h1> (the most important heading) to <h6> (the least important) heading tags.

注意:Use HTML headingsfor headings only. Don't use headings to make text BIG or bold

不要使用heading来实现文本字体的加粗或加大效果。

Search engines use your headings to index the structure and content of your web pages. 

搜索引擎使用heading来索引网页的结构和内容。


Paragraphs

Lines

The <hr> tag creates a horizontal line in an HTML page. 在网页中创建水平横线,用于分隔内容。


HTML Display

You cannot change the output by adding extra spaces or extra lines in your HTML code. Make no sense.

在HTML代码中写额外的空格或者是分段都不能改变文档的输出结果

The browser will remove extra spaces and extra lines when the page is displayed. Any number of new lines, and any number of spaces count asone space.

浏览器会删除多余的空格和分段,不论你在同一个元素里代码写了多少个空格(或新段落),都被记为一个空格。
需要在同一个 <p> 里分段记得用标签 <br>

HTML <pre> Element

该元素 定义了 a block of pre-formatted text, with structured spaces and lines.

因此,写在这个元素中的文本可以保留代码里的空格和分段格式。


Formatting Tags

HTML也定义了一些特殊的元素,用来给文本赋予特殊的 meaning。

Often <strong> renders as <b>, and <em> renders as <i>. However, there is a difference in the meaning of these tags: 

<b> or <i> defines bold or italic text only.

<strong> or <em> means that you want the text to be rendered in a way that the user understands as "important".

后两者表示希望指定的文本被用户理解为是重要的,而不仅仅是粗/斜体字,尽管目前浏览器让这些元素以粗体或斜体字显示。

If a browser one day wants to make a text highlighted with the strong feature, it might be cursive 草书体 for example and not bold!


HTML Text Formatting Tags

  • <b> bold text 粗体字

  • <em> emphasized text 强调文本

  • <i> a part of text in an alternate voice or mood 语气转变,通常斜体显示

  • <small> smaller text

  • <strong> important text

  • <sub> appears half a character below the baseline 低于基准线半个字符高度,用于化学式

  • <sup> superscripted text 高于基准线半个字符,用于脚注:WWW[1]

  • <ins> inserted text 给文本加下划线

  • <del> deleted text 给文本加删除线

  • <mark> new in H5 marked/highlighted text,高亮现实文本,IE8及之前不支持


0 0