HTML initial
Learn HTML+CSS first. Here we set a small goal: learn HTML first and then CSS.
HTML (English Hyper Text Markup Language abbreviation) Translated into Chinese “hypertext Markup Language”. Is a language used to describe web pages.
Summary: HTML is used to describe a web page with tags and display the content in the browser.
HTML skeleton
<html>
<head>
<title></title>
</head>
<body>
</body>
</html>
Copy the code
The document type
<! DOCTYPE html>Copy the code
Which version of HTML to use? We are using the HTML 5 version. There are many versions of HTML, so we should tell users and browsers which version we are using.
The tag is located at the beginning of the document and is used to tell the browser which HTML or XHTML standard specification is used in the current document. The tag must be used at the beginning of the document to specify the XHTML version and type for all XHTML documents so that the browser can parse according to the specified document type.
Note: Some of the older sites may still use older versions of the document type such as XHTML, but we are learning HTML5, and HTML5 document type compatibility is very good (backward compatibility principle), so you can feel comfortable using HTML5 document type.
Common HTML tags
Typesetting label
In order to make the page more semantic, we often use the title tag in the page, HTML provides six levels of title, namely:
< H1 >, < H2 >, < H3 >, < H4 >, < H5 > and < H6 >Copy the code
The basic syntax is as follows:
<hn> Title text </hn>Copy the code
Paragraph tags
In the web page to show the text orderly, can not do without paragraph tags, just as we usually write an article, the whole web page can also be divided into several paragraphs, and the paragraph label is:
<p> Text content </p>Copy the code
Horizontal label
<hr />
Copy the code
Wrap the label
In HTML, the text in a paragraph is arranged from left to right, up to the right end of the browser window, and then wrapped. If you want to force a line break for a segment of text, use a line break tag:
<br />
Copy the code
Text formatting tag
In web pages, sometimes you need to set up bold, italic, or underline effects for text. In this case, you need to use text formatting tags in HTML to make text appear in a special way.
B I s u strong em del ins
The link label
Creating a hyperlink in HTML is as simple as wrapping a tag around the object to be linked. The basic syntax is as follows:
<a href=" target "target=" target "> text or image </a>Copy the code
Href: The URL used to specify the target of the link. When the href attribute is applied to the tag, it acts as a hyperlink. Short for Hypertext Reference. It means hypertext reference
Target: indicates the opening mode of the linked page. The value can be
Self and blank, where self is the default and blank is the way to open in a new window.
Note:
1. For external links, add http:// www.baidu.com
< a href=”index.html”> home page
3. If the link target is not determined at that time, the href value of the link tag is usually defined as “#” (href=”#”), indicating that the link is temporarily an empty link.
4. You can not only create text hyperlinks, but also add hyperlinks to various web elements, such as images, forms, audio and video, etc.
The anchor point positioning
By creating anchor links, users can quickly locate the target content. There are two steps to creating an anchor link:
1. Use the "a href =" # id name > "link text" < / a > to create the link text (by clicking) < a href = "# two" > 2. Mark the location of the jump target with the corresponding ID name. <h3 id="two">įŽŽ2 æ </h3>Copy the code