HTML tables, form tags

1. Table

1. Overview

  • table is used to define a table.
  • tr is used to define a row in the table and must be nested in the table tag. If there are several pairs of tr in the table, there are several rows of the table.
  • th /td: used to define the cells in the table, must be nested in the <tr></tr> tag, a pair of <tr> </tr> contains several pairs of <td></td>, it means How many columns (or how many cells) are in the row.

Note:

  • <tr></tr> can only be nested
  • <td></td> tag, he is like a container, can hold all the elements

2. Table attributes:
Insert picture description here
3. Table structure:
Insert picture description here
4. Merge cells

Merging across rows: rowspan
Merging across columns: colspan

Steps to merge cells:

1、先判断跨行合并还是跨列合并
2、跨行合并用rowspan属性,跨列合并用个colspan属性  
3、将rowspan 或者colspan写在第一个要合并的单元格上
4、将合并的行数和列数写在指定的属性值上
5、将多余的单元格注释掉

Second, the form (form)

1 Overview

The role of the form in the web page cannot be underestimated. It is mainly responsible for the data collection function. For example, you can collect the name and e-mail address of the visitor, survey form, guestbook, etc.

A form has three basic components: Form tag: This contains the URL of the CGI program used to process the form data and the method for submitting the data to the server. Form field: contains text box, password box, hidden field, multi-line text box, check box, single selection box, drop-down selection box, file upload box, etc. Form buttons: including submit buttons, reset buttons and general buttons; CGI scripts used to transfer data to the server or cancel input. You can also use form buttons to control other processing tasks that have defined processing scripts.

Application scenario: Mainly used in data submission, such as clicking a button to send data to the server.

2. Label

In HTML, the form tag is used to define form fields, that is, to create a form to collect and transmit user information, and all the content in the form will be submitted to the server. The basic grammatical format for creating a form is as follows:
Insert picture description here
3. Common attributes

1、 action在表单收集到信息后,需要将信息传递给服务器进行处理,action属性用于指定接收并处理表单数据的服务器程序的url地址。
2、 method用于设置表单数据的提交方式,其取值为get或post。
Get 明文传输,数据量相对较少,不是很安全
Post 非明文传递,有请求体,数据量相对较大,较安全获取数据用get,发送数据用post
3、name用于指定表单的名称,以区分同一个页面中的多个表单。

4. Input control
Insert picture description here
note : A note about whether the button can submit the form:
Insert picture description here
disable:

 readonly:可读,不可编辑,可以传递
 disabled:不可编辑,不可传递

Guess you like

Origin blog.csdn.net/qq_41504815/article/details/114074894