Learning HTML - Basic (2)

HTML title

HTML 标题(Heading)是通过 <h1> - <h6> 等标签进行定义的。
<h1>This is a heading</h1>
<h2>This is a heading</h2>
<h3>This is a heading</h3>
HTML paragraph

HTML 段落是通过 <p> 标签进行定义的。

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
HTML links

HTML 链接是通过 <a> 标签进行定义的。
<a href="http://www.w3school.com.cn">This is a link</a>
HTML image

HTML 图像是通过 <img> 标签进行定义的。
<img src="w3school.jpg" width="104" height="142" />
HTML element

  • HTML documents are defined by the HTML element.
  • HTML element
  • Element refers to all HTML tags from the tag start (start tag) to the end tag (end tag) of
<p> This is a paragraph </p>
<a href="default.htm" > This is a link  </a>
<br />
HTML attributes

  • HTML tags can have attributes. Attribute provides more information about HTML elements.
  • Attributes are always in the form of name / value, such as: name = "value".
  • Attributes are always specified in the start tag HTML element.
HTML 链接由 <a> 标签定义。链接的地址在 href 属性中指定:
<a href="http://www.w3school.com.cn">This is a link</a>

For more information about the standard attributes, please visit: HTML Standard Attributes Reference Manual

HTML horizontal line

<hr /> 标签在 HTML 页面中创建水平线。
hr 元素可用于分隔内容。
<p>This is a paragraph</p>
<hr />
<p>This is a paragraph</p>
<hr />
<p>This is a paragraph</p>
HTML comments

Comments can be inserted into the HTML code, this can improve readability, make the code more easily understood. Comments are ignored by the browser, it will not display them.

注释是这样写的:
实例
<!-- This is a comment -->
HTML wrap

如果您希望在不产生一个新段落的情况下进行换行(新行),请使用 <br /> 标签:

<p>This is<br />a para<br />graph with line breaks</p>

<br> 还是 <br />
    您也许发现 <br> 与 <br /> 很相似。在 XHTML、XML 以及未来的 HTML 版本中,不允许使用没有结束标签(闭合标签)的 HTML 元素。即使 <br> 在所有浏览器中的显示都没有问题,使用 <br /> 也是更长远的保障。
HTML style attribute

Action style attribute: provides a general method of changing the style all HTML elements. HTML 4 style is introduced, it is a new preferred way to change the style HTML elements. Via HTML styles can be added by using an HTML style to the style attribute elements directly or indirectly defined in separate style sheets (CSS file).

<html>
    <body style="background-color:yellow">
        <h1 style="font-family:verdana">A heading</h1>
        <p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
        <h2 style="background-color:red">This is a heading</h2>
        <p style="background-color:green">This is a paragraph.</p>
        <h1 style="text-align:center">This is a heading</h1>
        <p>The heading above is aligned to the center of this page.</p>
    </body>
</html>
HTML text formatting

Many elements may be defined for HTML formatted output, such as bold and italics.

There are many examples w3school: the HTML text formatting Examples

Guess you like

Origin www.cnblogs.com/sinlearn/p/12333356.html