1. 程式人生 > >Python-html基礎復習

Python-html基礎復習

row infer cep mar 列表 center select orm utf8

1.有序和無序的列表

  order-ol-有序

  unorder-ul-無序

  

<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>

</ul>
<!order list>
<ol>
    <li>1</li>
    <li>2</li>
    <li>3</li>
</ol>>

2.cellpadding和cellspacing

  cellpadding:表格單元邊界和單元內的內容之間的距離

  cellspacing:不同單元格之間的距離

  

<table border="1px" cellpadding="20px" cellspacing="10px">

3.rowspan和colspan

  定義表格中在哪裏合並

  rowspan:跨行合並,就是豎著合並

  colspan:跨列合並,就是橫著合並

4.text-algin

  表明元素中的文字水平對齊的方式

  center-居中

  left:靠左

  right:靠右

  justify:兩端對齊

  inferit-以父標簽為準

5.塊級標簽和內聯標簽

  塊級標簽:獨占一行,可以調整width,height和padding及margin

  內聯標簽:可以和其他標簽共享一行,不能調整width,height/padding和margin

6,表單標簽

  enctype=‘multipart/form-data’:聲明表單內容由多個部分構成,包含文本和二進制數據,可以上傳文件,

  placeholder=空白時顯示的內容,用於提示

  select:可以有個optgroup,顯示選擇組,

7.簡單的web框架

  利用socket來進行收發數據,其中需要自定義響應頭

  

import socket

sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
sock.bind((
127.0.0.1,8080)) sock.listen(5) while 1: conn,addr=sock.accept() data=conn.recv(8096) #從客戶端得到的數據, file1=open(表單設計.html,rb) data2=file1.read() conn.send(bytes("HTTP/1.1 201 OK\r\n\r\n","utf8")) conn.send(data2) print(data2) conn.close()

Python-html基礎復習