Form day 45 form selector
01. form Form
Forms can get user input form (text, select, uploaded files), and the contents of the input passed to the back-end
parameter
action control address data submitted
Three kinds of ways to write
- Do not write the address of the current default data submitted towards this page is located
- Write full path ( https://www.baidu.com )
- Write only the path suffix (/ index /) will automatically be spliced current address
Way method to control the data submitted
- get form the default form to send get request
- post
input label
To use the label together under normal conditions
<label for='d1'>文本<input type='text' id='d1'></label> 绑定id值之后点击label标签内的任何位置都自动选中input框 <label for="d2">用户名:</label> <input type="text" id="d2"> 两者效果相同
form form of input to show different functions in different types of type
Value of the type property Manifestations Code corresponding text Single-line text input <input type="text" />
password Password input box <input type="password" />
date Date input box <input type="date" />
checkbox Check box <input type="checkbox" checked="checked" />
radio Single box <input type="radio" />
submit Submit button <input type="submit" value="提交" />
reset Reset button <input type="reset" value="重置" />
button Push button <input type="button" value="普通按钮" />
hidden Hidden input box <input type="hidden" />
file Text selection box <input type="file" />
disable input tag can be added to the input block property is disabled
The input tag value attribute may be added to set default values
Tags selected by the select key to set the default checkbox checked = 'checked' when the attribute names and values are the same attribute name only can be written
All labels get user input should have a name attribute
key attribute name is similar to a dictionary, input box acquired user input are input into the block value attribute
If you want to form a form submission data, the following parameters must be modified
enctype="multipart/form-data"
select the drop-down box label
One option is to label one option
The default is radio, you can make it into a multiple parameter by adding multiple choice
<select name='city' multiple> <option value="sh">上海</option> <option value="bj">北京</option> <option value="sz">深圳</option> </select> 标签内的信息是显示给用户看到value的值才是返回给后端的真实值
textarea tag to obtain a large section of the text
<textarea name='info' id='12' cols='100' rows='30'></textarea>
02. css
Cascading Style Sheets, label style for controlling html
Note/*单行注释*/
Usually alone when writing code written in a css css file, there is only css code
/*导航条样式*/
/*通用样式*/
/*轮播图样式*/
The grammatical structure of css
选择器 {属性1:属性值1}
Three ways to introduce css
By introducing external link tags css files (the most formal usage)
<link rel='stylesheet' href='css文件路径'>
Directly in the head on the html page css code by direct writing style tag
<style> h1{ color:green; } </style>
Inline style (style attribute directly written directly by the internal label) is not recommended
<h1 style='color:rad;'> 展示内容 </h1>
Find css
The basic selector
- Element selector
- id selector
- Class selector
- Universal selector
Combination selector
- div internal span all
- div> span internal layer
- div ~ span following peer
- div ~ span immediately following similar
Attribute selectors
Any default tab has its own attributes id class
Tag also supports you to customize any number of attributes (which means allowing label to help you carry some extra data)
Pseudo class selector
a tag has four states
- link is not clicked
- hover the mouse was suspended in the above
- Click on the active grimdeath
- After clicking visited
We will input the state after box into mouse called the input gain focus focus focus
State after the input frame is called out mouse loses focus
Pseudo-element selectors (remove the negative impact caused by floating)
You can add text by css
Selector priority
Introducing the same in different ways in the case of the selector
Follow the principle of proximity, who follow on from the past who label rendering
Where different selector
The row selector> id selector (second)> class selector (most common)> selector element