1-1 Basic Principles of the Internet

1. What is HTTP

(1)

HTTP is a hypertext transfer protocol that defines the format and mode for exchanging packets between clients and servers. Port 80 is used by default. It uses TCP as the transport layer protocol to ensure the reliability of data transmission. HTTP is a stateless protocol and the HTTP server does not store any information about the client. HTTP has two connection modes, a persistent connection and a non-persistent connection. A noncontinuous connection means that the server must establish and maintain a new connection for each requested object. The TCP connection is not closed by default and can be reused by multiple requests. The advantage of using persistent connections is that you can avoid the time taken to establish a three-way handshake for each TCP connection. A non-persistent Connection used before HTTP1.0, but you can request that the server not close the TCP Connection by adding Connection: keep -A live to the request. Persistent connections are the default after HTTP1.1. Currently, most browsers support up to six persistent connections to the same domain.

(2) HTTP request packets and response packets

(For example, when the client wants to request www.immoc.com/b/a.html, it sends a request to the server. After the server looks for it, it replies to the client with file A.HTML.)

Request packet HTTP request packets are in the following formats: GET/ HTTP/1.1 User-agent: Mozilla/5.0(Macintosh; Intel Mac 0S X 10_10_5)Acce pt: **

The first line of an HTTP request is called the request line, and the following lines are called the header line. The header line can also be followed by an entity body. There is a blank line after the request header. This blank line cannot be omitted. It is used to separate the header from the entity. The request line contains three fields: the method field, the URL field, and the HTTP version field. Method fields can take several different values, typically GET, POST, HEAD, PUT, and DELETE. The normal GET method is only used to GET data from the server. The POST method is used to submit an entity to a specified resource, usually resulting in a modification of the server resource. The HEAD method is similar to the GET method, but does not contain the request object in the response returned. The PUT method is used to upload files to the server, and the DELETE method is used to DELETE objects on the server. There are many ways to request, but there is a semantic difference. It does not mean that GET cannot do what POST can do. It depends on how we choose to do it.

Response packet The format of an HTTP response packet is as follows: HTTP/1.0 200 OK Content-type: text/plain Content-Length: 137582 Expires: Thu, 05 Dec 1997 16:00:0GMT LAST-Modified: Wed, 5 August 1996 15:55:28 GMT Server: Apache 0.84

Common states are 200- request successful, 202- The server has received the request message but has not processed 301- Permanent move, 302- Temporary move, 304- The requested resource is not modified, 400- the client request syntax error, 404- the requested resource does not exist 500- server internal error. Generally, 1XX indicates that the server receives the request, 2XX indicates success, 3XX indicates redirection, 4XX indicates an error on the client, and 5XX indicates an error on the server.

2. What are front-end and back-end

1-2 Know the HTML5 skeleton

1. Document Type Declaration DTD (Document Type Definition)

Doctype is a DTD document definition type that must be declared in the first line of an HTML document. It is used to specify how the document should parse HTML. The three modes are weird. Standard mode, almost mode (IE8 has a mode that is almost in between); While standard mode defines rendering in TERMS of HTML and CSS, weird mode emulates older browser behavior

2. The character set

Change character setNo matter which character set is used, set the file to the same character set in the vscode editor (otherwise garbled), and then change the meta tag

1-3 Title, keywords, page description

Title Sets the title of the web page. The text is displayed on the TAB bar of the web page

Reasonable setting of web page keywords and page description, is also an important means of SEO SEO (Search Engine Optimization, Search Engine Optimization) use of the rules of the Search Engine to improve the site in the Search Engine within the natural ranking, so that the site in the Search Engine results occupy the leading position, Gain brand revenue

Meta tags are used to set the keywords and descriptions of web pages. The name attribute is very important to set the specific functions of the meta

1-4 HTML 5 features

1. Blank fold

Multiple Spaces between text and text. A newline is folded into a single space

2. Escape characters

2-1 List labels

1. Ordered lists

Note: The LI label cannot be scattered. It must be a sublabel of the OL or UL label

The sub label of OL can only be the LI label

You can put anything in the LI tag

The reversed property of the OL tag

The reversed attribute specifies whether the entries in the list are in reverse order. The reversed attribute does not require a value, just a reversed word, which is a new feature of HTML5

    2. Unordered lists

    Note: 1. An unordered list is a parent-child tag and cannot appear alone

    1. The ul label must be LI. No other labels appear

    2. The LI tag is a container that can be filled with any tag

    Define a list

    3-1 Multimedia and Semantic tags

    1. Image labels

    (1) Format (2) Picture format (3) Relative path and absolute pathRelative path: Description from the web page, how to find the picture absolute path: describe the exact location of the picture

    2. Hyperlinks

    3. Audio and video

    1. Audio

    <audio controls SRC =" audio address "></audio>

    (1) Autoplay audio playback (2) Loop playback

    2. Video

    <video contorls SRC =" video address "loop autoplay></audio>

    3. Block labels

    4. Semantic labels

    <span> <strong> <em>

    4-1 Form label

    1. Form creation

    controls

    1. Radio button

    1. The radio button must have a value attribute value, and value 2 is submitted to the server. If checked is checked, the radio button is selected by default

    2. The label tag

    Label Binds a text to a radio button. When a user clicks a text, the radio button is also clicked by default

    3. Check box

    Check boxes of the same group should have their names set to the same value. Check boxes must have value property values, which are submitted to the server

    4. Drop-down menu

    <select><option> </option></select>

    5. Multi-line text box

    rows and COLs properties, used to define the number of rows and columns in a multi-line text box

    6. Three buttons

    3.HTML5 added form controls

    5-1 form label