web html expression Three Musketeers

Entry of a .web html

1.html small scale chopper

Computer to do client, browser do server, perform bs communication; self-built PC client and server principle is similar to the previous, server and client perform cs communication.

import socket
def main():
    sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)   
    sock.bind(('localhost',8080))    
    sock.listen(5)    
    while True:
        connection,address = sock.accept()        
        buf = connection.recv(1024)        
        connection.sendall(bytes("HTTP/1.1 201 OK\r\n\r\n","utf8"))        
        connection.sendall(bytes("<h1>hello world</h1>","utf8"))        
        connection.close()
if __name__ == "__main__":
    main()

Different front-end presentation title

connection.sendall(bytes("<h1>hello world1</h1> <h2>hello world2</h2> <h3>hello world3</h3> <h4>hello world4</h4>","utf8"))

 

Secondly, if .html write code, and () opened with f.open, and run. Open the test.html file, as follows

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h1>hello world</h1>
<h3>hello world</h3>
<img src="html_image.PNG" alt="">

</body>
</html>

Load files with html.py

import socket
def main():
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.bind(('localhost', 8087))
    sock.listen(5)
    while True:
        connection, address = sock.accept()
        buf = connection.recv(1024)
        connection.sendall(bytes("HTTP/1.1 201 OK\r\n\r\n", "utf8"))
        f = open("test.html","rb")
        data = f.read()
        connection.sendall(data)
        connection.close()
if __name__ == "__main__":
    main()

css layout with

Automatic carousel js / manual rotation / tab switching

jss suspended animation

 

2. Construction of html page

html definitions: htyper text markup language ie HTML;

Hypertext: refers to the inside pages can contain images, links, and even music, programs and other non-text elements;

Markup Language: mark (label) constitute language.

== HTML page document, parsed by the browser to display

Static pages: static resources such as xxx.html

Dynamic pages: html code language developed by some dynamically generated according to a user request

2.1html document tree structure:

 

2.2 tag definitions

2.3 Label properties

1 explains point: in the tag can be inserted into key-value pair, <h1 name = "alex"> hello world </ h1>

Point 4 explained:

< INPUT type = "text" Readonly = "Readonly" > 
The above line is equal to 
< INPUT type = "text" Readonly >

2.4 <iDOCTYPEhtml> tag

 

 

Guess you like

Origin www.cnblogs.com/yuyukun/p/12227285.html