HTML and CSS teaching-Chapter 2 HTML Basics

Source: Internet
Author: User

Chapter 2 HTML Basics

Key points of this Chapter
Structure of HTML code
Composition of HTML Web pages

Directory:
2.1 Structure of HTML code
2.2 HTML webpage Composition
2.3 HTML web page browsing and Testing
2.4 Comprehensive instances

2.1 Structure of HTML code
1. HTML code Composition

The symbols used by HTML to describe the function are called "tags ". Such as <HTML>, <body>, and <Table>. The tag must be enclosed in square brackets "<>" and appear in pairs. The tag without a slash indicates the start of the tag, A tag with a slash indicates the end of the tag.

2.1 Structure of HTML code
2. Comments and blank spaces

(1) Notes
HTML comments are text content that appears in HTML source documents, but are not displayed in browsers. The biggest difference for comments is that HTML cannot be nested. There are two ways to comment:

Annotation Method 1:
<! --- Note --->
Annotation Method 2:
<Comment>... </Comment>
(2) space character
The space character in the HTML page does not have the function of adjusting the spacing (only the first space character is valid when multiple space characters are added). To use the space character correctly, use the HTML space character to complete the space character function. Space characters are controlled by code.

Basic Syntax: & nbsp
3. Tag nesting

In most cases, a tag must be placed inside another tag. This process is called a nested tag. The tag closest to the content of the nested tag must be ended first, in the order of internal and external.
4. Standard attributes

HTML tags can have attributes. Attribute provides more information about HTML elements. Attribute always appears in the form of name = "value. For example, name = "form1", where "name" is the property name, and "form1" is the property value. The attribute value is always specified in the starting mark of the HTML element. The tags and attributes are described as follows:
(1) HTML tags are used to mark HTML elements.
(2) HTML tags are surrounded by symbols <"and">.
(3) HTML tags appear in pairs. For example, <p> and </P>.
(4) the text between the start tag and the end tag is the content of the element.
(5) HTML tags are case-insensitive. <B> and <B> have the same effect.

2.2 HTML webpage Composition
1. html webpage Structure
When compiling HTML files, you must follow the HTML syntax rules. A complete HTML document consists of titles, paragraphs, tables, and other objects.
All HTML files generally contain this structure identifier.
<! Doctyle...>
<HTML>
<Head>
</Head>
<Body>
</Body>
</Html>

2. html tag and Its Attributes
......

3. Head tag and Its Attributes
<Head> tags are used to encapsulate other tags in the document header. Place the tag at the beginning of the document, followed by the <HTML> tag and before the <body> tag or <frameset> tag. The

4. Body Tag and Its Attributes
Text: Set the color of the page text.
Bgcolor: Set the page background color
Bgproperties sets the background image of the page to be fixed and does not scroll with the page
Link: sets the default link color of the page.
Alink sets the link color when the mouse is clicked
Vlink sets the link color after access
Topmaggin sets the top margin of the page
Leftmargin: Set the left margin of the page
 

2.3 HTML web page browsing and Testing
1. Use IE and Firefox to browse HTML webpages

(1) use IE to browse HTML webpages
Select File | open, Click Browse to find the webpage files stored in the hard disk, and then click open, the browser will be able to display the page effect of the webpage.

(2) Mozilla Firefox
Firefox 3.6 has built-in support for personas skin, CSS, Dom, and HTML5, as well as full-screen video playback and open-source "Web open font format ". In addition, Firefox 3.6 adds a new security feature to check plug-in versions such as Flash Player and QuickTime to ensure that they are the latest version and shield plug-ins with security issues, remind the user to update the plug-in.

2. Use firebug to test HTML webpages
Firebug is a powerful web development tool integrated with Firefox developed by joe hewitt. It allows you to edit, debug, and monitor CSS, HTML, and JavaScript on any page in real time.

2.4 Comprehensive instances

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.