Home >Web Front-end >H5 Tutorial >Detailed explanation of Html5 semantic tags and compatibility processing
is mainly used to introduce information in the header of the page, and can also be used in the section header The title combines a title and a subtitle, or a combination of slogans
Navigation (a list containing links)
< nav>
< /ul>
The bottom of the footer page or the bottom of the section
< img src="miaov.png"/>(note there is no alt)
Used to express time or date
We open at every morning.
ParametersI have a date on .
Option list.
Use with the input element to define the possible values of the input.
The Open attribute is expanded by default
< summary> the title of the details element
The well-known IT training institution in China
Define a dialogue
Words or sentences that need to be marked
76
tag
For browsers like IE6-8 that do not support HTML5 semantic tags, we can use javascript to solve them as follows:
Add at the head of the page:
<script></p> <p>document.createElement(“header”);</p> <p>document.createElement(“ nav”);</p> <p>document.createElement(“footer”);</p> <p>……</p> <p></script>
Style
HTML5 semantic tags under IE6-8, after we create them with js, they will not have any default style or even display, so the default display of these tags must be defined in the style sheet
New input control
email: Email text box, no different from ordinary ones. When the input is not an email, the verification fails. The mobile keyboard will change
tel: Telephone Number
url: The URL of the webpage
search: After entering text in the search engine chrome, there will be an additional closed X
range: The value selector min within a specific range , max, step (number of steps) Example: Use JS to display the current value
New input control_2
number: An input box that can only contain numbers
color: Color picker
datetime: Display the complete date
datetime-local: Display the complete date without time zone
time: Display time without time zone
date: Display date
week: Display week
month: Display month
New form features and functions
placeholder: Input box prompt Information example: Weibo's password box prompt
autocomplete: Whether to save the user input value is on by default. To close the prompt, select off
autofocus: Specify the form to obtain input focus
list and datalist: Construct a selection list for the input box. The list value is the id of the datalist tag.
required: This item is required and cannot be empty.
Pattern: Regular verification pattern="\d{1 ,5}"
Form verification
validity object, you can check whether the verification is passed through the following valid. If all eight verifications pass, it returns true, and if one verification fails, it returns false
oText.addEventListener("invalid",fn1,false);
ev.preventDefault()
valueMissing: When the input value is empty
typeMismatch: The control value matches Expected type mismatch
patternMismatch: the input value does not meet the pattern regularity
tooLong: exceeds the maxLength maximum limit
rangeUnderflow: the verified range minimum value
rangeOverflow : The maximum value of the verified range
stepMismatch: Verify whether the current value of the range conforms to the rules of min, max and step
customError does not meet the custom verification
setCustomValidity(); Custom validation
Invalid event: Validation feedback
input.addEventListener('invalid',fn,false)
Prevent default validation: ev.preventDefault()
formnovalidate attribute: turn off verification
Formaction defines the submission address in submit
The above is the detailed content of Detailed explanation of Html5 semantic tags and compatibility processing. For more information, please follow other related articles on the PHP Chinese website!