191121HTML
标签:
一、HTML 1、web server import socket def handle_request(client): buf = client.recv(1024) client.send(bytes("HTTP/1.1 200 OK\r\n\r\n", encoding='utf-8')) client.send(bytes("<h1 style='background-color:red;'>Hello, Seven<h1>", encoding='utf-8')) def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost', 9999)) sock.listen(5) while True: conn, addr = sock.accept() handle_request(conn) conn.close() if __name__ == '__main__': main() 2、web server2 import socket def handle_request(client): buf = client.recv(1024) client.send(bytes("HTTP/1.1 200 OK\r\n\r\n", encoding='utf-8')) f = open('index', 'rb') data = f.read() f.close() client.send(data) def main(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(('localhost', 9999)) sock.listen(5) while True: conn, addr = sock.accept() handle_request(conn) conn.close() if __name__ == '__main__': main() 3、实例index.html <h1 style='background-color:red;'>Hello, Seven<h1> <a href=''>baidu</a> <table border='1'> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <table> 4、head标签meta 标签:编码、跳转、刷新、关键字、描述、IE兼容
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"> <!-- 页面编码 --> <meta http-equiv="Refresh" content="60"> <!-- 60s自动刷新一次页面 --> <!--<meta http-equiv="Refresh" content="5; url=http://www.baidu.com" /> 5s后跳转到目标网站--> <meta name="keywords" content="dongfei,dongfei2"> <meta http-equiv="X-UA-Compatible" content="IE=IE9;IE=IE8" /> <title>Title</title> </head> <body> <h1>welcome dongfei web site.</h1> </body> </html>title标签
link标签:加图标
<link rel="shortcut icon" href=http://www.mamicode.com/"image/favicon.ico"> <!--给网站加图标-->style
script
5、body标签5.1:各种符号
空格:?
大于:>
小于:<
参考:
5.2:p和br
p:段落,段落之间有间距
br:换行
5.3:标题,加大加粗
h1...h6
5.4:snap标签,行内白板
5.5:div标签,块级白板
6、表单标签from标签
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>login</title> </head> <body> <form action=":xxx/index" method="get"> <!-- 向后端提交表单 --> <input type="text" name="username"/> <input type="text" name="email"/> <input type="password" name="password"/> <input type="button" value="login"/> <!--button默认没有任何功能--> <input type="submit" value="login2"/> </form> </body> </html>提交至搜索引擎
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>sougou</title> </head> <body> <form action="https://www.sogou.com/web" method="get"> <input type="text" name="query" value="sogou"/> <!--value:默认值--> <input type="submit" value="搜索"> </form> </body> </html>单选框&复选
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> </head> <body> <form> <div> <p>请选择性别:</p> 男:<input type="radio" name="gender" value="1" checked="checked" /> 女:<input type="radio" name="gender" value="2" /> <p>爱好:</p> 篮球:<input type="checkbox" name="favor" value="1" /> 足球:<input type="checkbox" name="favor" value="2" /> 乒乓球:<input type="checkbox" name="favor" value="3" /> </div> <input type="submit" value="提交" /> </form> </body> </html>温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/43057.html