01HTML tag attributes

HTML tag attributes

1. Label

The label consists of three parts: label name, label attribute and text content (single label has no text content)

2. The label attribute is a description of the label

3. Label attributes

Label attributes are divided into general attributes, own attributes and custom attributes

4. Universal label

All tags have attributes: ​ id: unique identification name (id name, must be unique in a web page) ​ class: give the tag a class name ​ style: set the inline style of the label ​ title: when the mouse is moved to The label, the prompt content displayed

5. Custom label attributes

Usually used to pass values ​​or lazy loading of pictures, etc. Format: data-custom words

6, table form

Mainly used to present formatted data

The table is composed of rows and columns

format:

        <table> 
            <tr> Row 
                 th--header, which mainly explains the following content. The content of th will be automatically bolded and centered. 
                <th></th> Header 
                <td></td> Column 
                <td> </td> 
                .... 
            </tr> 
            ... 
        </table>

Table table attributes:

border: set the border of the table; width: set the width of the table; align: set the alignment of the table;

align: horizontal alignment left/center/right

valign: vertical alignment top/middle/bottom

cellspacing: set the pixel interval; cellpadding: set the cell gap

7. Cross-row/cross-column attributes

Mainly used to draw complex tables

  • rowspan: inter-row

  • colspan: cross-column

8. Complete table composition:

caption (title), thead (header), tbody (body) and tfoot (footer) four parts

9, form form label

It is one of the core tags of all tags, and it is an important tag used to achieve front-end interactions​

Common attributes:

  • name: the name of the form

  • action: The location where the form data is submitted (usually a back-end file name or website). If it is #, it means submit to the current file

  • method: The method for submitting the front-end to the back-end, mainly GET/POST, the default is GET

Form element classification

1) input class

input input class, mainly used to input, select or issue instructions

Mainly use the type attribute to distinguish multiple states

type:text/password/radio/checkbox/file/button/image/submit/reset

  • text: Single-line text input box type="text" You don’t need to write, type defaults to text attribute attributes: placeholder (prompt)/name (name)/minlength (at least the number of characters entered) /maxlength (the maximum number of characters entered) )/Disabled/readonly value (set default value)/pattern (regular matching)

  • password: The password box attributes are the same as text

  • radio: radio button, only one option can be selected, and the options are usually more than two. Commonly used attributes: name (must have)/value/checked (can only be used in one place)/disabled (disabled)/readonly (read only) )

  • checkbox: checkbox, you can select one or more common attributes: name (required)/value/checked (selected by default, can be used in multiple places)/disabled (invalid)/readonly (read only)

  • file: File upload button

  • button: Normal button, usually used to issue instructions and call script code. Common attributes: value (title of the button)/disabled (invalid)

  • image: picture button, usage has a special attribute like button: src (used to load picture, replace value with ta)

  • submit: submit button, used to submit the data of the form to the background. Common attributes: value (the title of the button)/disabled (invalid)

  • reset: Reset the button, clear all the input content of all the components of the form, and restore it to the initial state. Common attributes: value (the title of the button)/disabled (invalid)

2) textarea class

Text field (also called multi-line text box), mainly used to enter large quantities of content

Common attributes: name/id/value/cols (number of columns)/rows (number of rows)/placeholder/minlength/maxlength/required (required)

3) select class***

The drop-down list box is used for single selection by default, and each option is presented with option

  • multiple attribute: Indicates that multiple items can be achieved

  • size: the maximum number of rows displayed

4) Button class

  • Common button, with submit function, can be used alone, but not written in the form element;

  • If there is a submit function written in the form

10. iframe: frame set

It is used to combine multiple webpage files into one file.

Common attributes:

  • name: frame name

  • src: Import external HTML files

  • scrolling: add scroll bar (YES/NO/AUTO)

  • height: height (%/px)

  • width: width (%/px)

  • frameborder: whether there is a border (0/1)

  • marginheight: the distance between the frame and the top or bottom (%/px)

  • marginwidth: the distance between the frame and the left and right (%/px)

Guess you like

Origin blog.csdn.net/weixin_42248871/article/details/109910337