Introduction and compatibility of progress bar SS in HTML5, html5progress
1. Basic understanding of progress Elements
1. Basic UI
The progress element belongs to the HTML5 family and refers to the progress bar. IE10 + and other reliable browsers are supported. Simple code:
Copy XML/HTML Code to clipboard
- <Progress> o (︶ ︿ ︶) o </progress>
It's a progress bar with a sense. Someone is surprised: "Alas ~ How can I see a Letter of emotion ?" Well... I can only say to you: "If you despise you, are you reluctant to use a reliable browser ?!"
The default effect varies with different browsers, as shown below (in window 7 ):
The effect of IE10 granules on slow and scattered particles is quite eye-catching.
2. Basic Attributes
Max, value, position, and labels.
(1) max refers to the maximum value. By default, the Progress value ranges from 0.0 ~ 1.0. If it is set to max = 100, the Progress value range is from 0 ~ 100.
(2) value is the value. If max = 100 and value = 50, the progress is exactly half. The existence of the value Attribute determines whether the progress bar of the progress is deterministic. What does it mean? For example, if <progress> </progress> has no value, it is uncertain. Therefore, in IE10 browser, it looks like an infinite loop of virtual point animation. However, once the value attribute is available (even if there is no value), such as <progress value> </progress>, it is also regarded as OK. The dotted point animation enters the XianRen mode --> changed the bar, as follows:
(3) position is a read-only attribute. It indicates the position of the current progress, that is, the value of value/max. If the progress bar is uncertain, the value is-1.
(4) labels is also a read-only attribute, and the label elements pointing to the progress element are obtained. For example, document. querySelector ("progress ).
Ii. Example of progress element compatibility Processing
Html code
Copy XML/HTML Code to clipboard
- <Progress max = "100" value = "20"> <ie style = "width: 20%;"> </ie> </progress>
Css compatible code
Copy the content to the clipboard using CSS Code.
- Progress {
- Display: inline-block;
- Width: 160px;
- Height: 20px;
- Border: 1px solid #0064B4;
- Background-color: # e6e6e6;
- Color: #0064B4;/* IE10 */
- }
- /* Ie6-ie9 */
- Progress ie {
- Display: block;
- Height: 100%;
- Background: #0064B4;
- }
- Progress:-moz-progress-bar {background: #0064B4 ;}
- Progress:-webkit-progress-bar {background: # e6e6e6 ;}
- Progress:-webkit-progress-value {background: #0064B4 ;}
Basically, the perfect solution solves the differences between browsers.