Starting HTML from scratch (1 2016/9/19)

WBOY
Release: 2016-09-20 03:29:59
Original
1310 people have browsed it

1. Attributes

HTML tags can have attributes. Attributes provide more information about an HTML element. Properties always appear as name/value pairs, such as: name="value".

Attributes are always specified in the opening tag of an HTML element.

Attribute example 1:

Defines the beginning of the title.

has additional information about alignment.

Attribute example 2:

defines the body of the HTML document.

has additional information about the background color.

Attribute example 3:

defines HTML table.

has additional information about the table border.

The Complete HTML Reference Manual provides a complete list of legal attributes available for each HTML element:

HTML reference manual: http://www.w3school.com.cn/tags/index.asp

2.Title

Heading is defined through tags such as

-

.

defines the largest heading.

Defines the smallest heading.


tag creates a horizontal line in an HTML page. Can be used to split elements

3. Paragraph

Paragraphs are defined through the

tag.

① It is a bad habit to use empty paragraph tags

to insert a blank line. Replace it with the
tag.

② If you want to wrap (new line) without creating a new paragraph, use the
tag

4.Style

The style attribute is used to change the style of HTML elements.

The

style attribute provides a universal way to change the style of all HTML elements. HTML styles allow you to add styles directly to HTML elements using the style attribute, or indirectly by defining them in a separate style sheet (CSS file).

The background-color attribute defines the background color for the element, such as:

The font-family, color and font-size attributes respectively define the font family, color and font size of the text in the element.

text-align attribute specifies the horizontal alignment of text in the element:

This is a heading

, you can change center to left, rght to achieve different effects .

5. Quote

① HTML element definition short quote. Browsers usually surround elements with quotes.

<p>WWF 的目标是:<q>构建人与自然和谐共存的世界。</q></p>
Copy after login

② HTML

for long quotes, the HTML
element defines the section being quoted. Browsers usually indent the
element.

<p>以下内容引用自 WWF 的网站:</p>
<blockquote cite="http://www.worldwildlife.org/who/index.html">
五十年来,WWF 一直致力于保护自然界的未来。
世界领先的环保组织,WWF 工作于 100 个国家,
并得到美国一百二十万会员及全球近五百万会员的支持。
</blockquote>
Copy after login

③ HTML for abbreviations HTML Element definition Abbreviation or acronym. Tagging abbreviations provides useful information to browsers, translation systems, and search engines.

6.How to introduce CSS styles

There are three ways to insert style sheets:

① External: When styles need to be applied to many pages, external style sheets will be the ideal choice. Using external style sheets, you can change the look of your entire site by changing one file.

<span style="color: #0000ff;"><</span><span style="color: #800000;">head</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="stylesheet"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="text/css"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="mystyle.css"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"></</span><span style="color: #800000;">head</span><span style="color: #0000ff;">></span>
Copy after login

② Internal: When a single file requires special styling, you can use an internal style sheet. You can define internal style sheets via the