{"id":3034,"date":"2013-02-21T21:07:04","date_gmt":"2013-02-21T13:07:04","guid":{"rendered":"http:\/\/www.zhangxinxu.com\/wordpress\/?p=3034"},"modified":"2019-10-17T19:44:48","modified_gmt":"2019-10-17T11:44:48","slug":"html5-progress-element-style-control","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2013\/02\/html5-progress-element-style-control\/","title":{"rendered":"HTML5 progress\u5143\u7d20\u7684\u6837\u5f0f\u63a7\u5236\u3001\u517c\u5bb9\u4e0e\u5b9e\u4f8b"},"content":{"rendered":"<p>by <a href=\"http:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a><br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=3034\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=3034<\/a><\/p>\n<h3>\u4e00\u3001progress\u5143\u7d20\u57fa\u672c\u4e86\u89e3<\/h3>\n<p><strong>\u57fa\u672cUI<\/strong><br \/>\n<code>progress<\/code>\u5143\u7d20\u5c5e\u4e8eHTML5\u5bb6\u65cf\uff0c\u6307\u8fdb\u5ea6\u6761\u3002IE10+\u4ee5\u53ca\u5176\u4ed6\u9760\u8c31\u6d4f\u89c8\u5668\u90fd\u652f\u6301\u3002\u5982\u4e0b\u7b80\u5355code:<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;progress>o(\ufe36\ufe3f\ufe36)o&lt;\/progress><\/pre>\n<\/div>\n<p>\u6548\u679c\uff1a<progress>o(\ufe36\ufe3f\ufe36)o<\/progress>\n<p>\u662f\u4e2a\u5f88\u5e26\u611f\u7684\u8fdb\u5ea6\u6761\u5427\u3002\u6709\u4eba\u5947\u602a\uff1a\u201c\u5509~\u600e\u4e48\u6211\u770b\u5230\u7684\u662f\u4e2a\u5b57\u7b26\u8868\u60c5\u634f\uff1f\u201d \u6069&#8230;\u6211\u53ea\u80fd\u5bf9\u4f60\u8bf4\uff1a\u201c\u9119\u89c6\u4f60<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/105.gif\">\uff0c\u4e2b\u7684\u90fd\u820d\u4e0d\u5f97\u7528\u9760\u8c31\u70b9\u7684\u6d4f\u89c8\u5668\u5417\uff1f\uff01\u201d<\/p>\n<p>\u8fd9\u4e2a\u9ed8\u8ba4\u7684\u6548\u679c\uff0c\u4e0d\u540c\u6d4f\u89c8\u5668\u4e0b\u7684\u6548\u679c\u4e0d\u5c3d\u76f8\u540c\uff0c\u5982\u4e0b\u622a\u56fe\u4eec\uff08window 7\u4e0b\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_153535.png\" width=\"456\" height=\"417\" alt=\"\u5404\u4e2a\u73b0\u4ee3\u6d4f\u89c8\u5668\u4e0bprogress\u9ed8\u8ba4\u7684\u6837\u5f0f\u622a\u56fe\" class=\"alignnone\" \/><\/p>\n<p>IE10\u9897\u7c92\u7684\u7f13\u52a8\u805a\u6563\u6548\u679c\uff0c\u8fd8\u662f\u633a\u8ba9\u4eba\u773c\u524d\u4e00\u4eae\u7684\u3002<\/p>\n<p><strong>\u57fa\u672c\u5c5e\u6027<\/strong><br \/>\n<code>max<\/code>, <code>value<\/code>, <code>position<\/code>, \u4ee5\u53ca<code>labels<\/code>.<\/p>\n<ul>\n<li><code>max<\/code>\u6307\u6700\u5927\u503c\u3002\u82e5\u7f3a\u7701\uff0c\u8fdb\u5ea6\u503c\u8303\u56f4\u4ece<code>0.0~1.0<\/code>\uff0c\u5982\u679c\u8bbe\u7f6e\u6210<code>max=100<\/code>, \u5219\u8fdb\u5ea6\u503c\u8303\u56f4\u4ece<code>0~100<\/code>.<\/li>\n<li><code>value<\/code>\u5c31\u662f\u503c\u4e86\uff0c\u82e5<code>max=100<\/code>, <code>value=50<\/code>\u5219\u8fdb\u5ea6\u6b63\u597d\u4e00\u534a\u3002<code>value<\/code>\u5c5e\u6027\u7684\u5b58\u5728\u4e0e\u5426\u51b3\u5b9a\u4e86<code>progress<\/code>\u8fdb\u5ea6\u6761\u662f\u5426\u5177\u6709<strong>\u786e\u5b9a\u6027<\/strong>\u3002\u4ec0\u4e48\u610f\u601d\uff1f\u6bd4\u65b9\u8bf4<code>&lt;progress>&lt;\/progress><\/code>\u6ca1\u6709<code>value<\/code>\uff0c\u662f\u4e0d\u786e\u5b9a\u7684\uff0c\u56e0\u6b64IE10\u6d4f\u89c8\u5668\u4e0b\u5176\u957f\u76f8\u662f\u4e2a\u65e0\u9650\u5faa\u73af\u7684\u865a\u70b9\u52a8\u753b\uff1b\u4f46\u662f\uff0c\u4e00\u65e6\u6709\u4e86<code>value<\/code>\u5c5e\u6027\uff08\u5373\u4f7f\u65e0\u503c\uff09\uff0c\u5982<code>&lt;progress value>&lt;\/progress><\/code>, \u4e5f\u88ab\u8ba4\u4e3a\u662f\u786e\u5b9a\u7684\uff0c\u865a\u70b9\u52a8\u753b\u8fdb\u5165\u4ed9\u4eba\u6a21\u5f0f\u2014\u2014&gt;\u53d8\u6761\u6761\u4e86\uff0c\u5982\u4e0b\u622a\u56fe\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_160905.png\" width=\"301\" height=\"78\" alt=\"IE10 \u6dfb\u52a0value\u540e\u8fdb\u5165\u4ed9\u4eba\u6a21\u5f0f\" class=\"alignnone\" \/>\n<\/li>\n<li><code>position<\/code>\u662f\u53ea\u8bfb\u5c5e\u6027\uff0c\u987e\u540d\u601d\u610f\uff0c\u5f53\u524d\u8fdb\u5ea6\u7684\u4f4d\u7f6e\uff0c\u5c31\u662f<code>value \/ max<\/code>\u7684\u503c\u3002\u5982\u679c\u8fdb\u5ea6\u6761\u4e0d\u786e\u5b9a\uff0c\u5219\u503c\u4e3a<code>-1<\/code>.<\/li>\n<li><code>labels<\/code>\u4e5f\u662f\u53ea\u8bfb\u5c5e\u6027\uff0c\u5f97\u5230\u7684\u662f\u6307\u5411\u8be5<code>progress<\/code>\u5143\u7d20\u7684<code>label<\/code>\u5143\u7d20\u4eec\u3002\u4f8b\u5982<code>document.querySelector(\"progress\").labels<\/code>\uff0c\u8fd4\u56de\u7684\u5c31\u662f<code>HTMLCollection<\/code>, \u4e0b\u4e3a\u6211\u7684\u67d0\u6d4b\u8bd5\u622a\u56fe\uff08\u622a\u81eaOpera\u6d4f\u89c8\u5668\u4e0b\uff0c\u76ee\u524dFireFox18.0.2\u4ee5\u53caIE10\u8c8c\u4f3c\u90fd\u4e0d\u652f\u6301\uff09\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_163358.png\" width=\"494\" height=\"66\" alt=\"Opera\u6d4f\u89c8\u5668\u4e0b\u7684\u6d4b\u8bd5\u7ed3\u679c\" class=\"alignnone\" \/><\/li>\n<\/ul>\n<h3>\u4e8c\u3001progress\u5143\u7d20\u7684\u6837\u5f0f\u63a7\u5236<\/h3>\n<p>\u9996\u5148\uff0c\u5f88\u6709\u610f\u601d\u7684\u4e00\u70b9\uff0c\u65e0\u8bba\u54ea\u4e2a\u73b0\u4ee3\u6d4f\u89c8\u5668\uff0c\u53ea\u8981\u8bbe\u7f6e\u4e86<code>border<\/code>\u6216<code>background-color<\/code>\u6837\u5f0f\uff0c\u8fdb\u5ea6\u6761\u5143\u7d20\u5c31\u4f1a\u53d8\u6210\u6241\u5e73\u5316\u98ce\u683c\u3002<\/p>\n<p><strong>\u6837\u5f0f\u63a7\u5236\u7684\u5de8\u5927\u5dee\u5f02<\/strong><br \/>\n\u4ece\u6807\u9898\u53ef\u4ee5\u770b\u51fa\u8fd9\u6bb5\u662f\u6700\u7889\u5821\u7684\u5730\u65b9\u3002\u5927\u4f17\u8138\u81ea\u7136\u6ca1\u4ec0\u4e48\u8bf4\u5934\uff0c\u6b63\u56e0<code>progress<\/code>\u5143\u7d20\u6837\u5f0f\u7684CSS\u63a7\u5236\u5dee\u5f02\u4e4b\u5927\uff0c\u624d\u6210\u4e3a\u4e86\u8c08\u8d44\u3002<\/p>\n<p>\u8111\u4e2d\u68b3\u7406\u4e86\u4e0b\uff0c\u60f3\u8981\u4e09\u8a00\u4e24\u8bed\u8868\u8ff0\u6e05\u695a\u597d\u6293\u72c2\u7684\u6765<img decoding=\"async\" src=\"http:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/35.gif\">~  \u6c42\u52a9\u5916\u63f4\uff0c\u5f53\u5f53\u5f53\u5f53\u2014\u2014\u8868\u683c\u541b\u3002<\/p>\n<p>\u4e00\u822c\u800c\u8a00\uff0c\u4e00\u4e2a\u8fdb\u5ea6\u6761\u5143\u7d20\u5206\u4e3a\u4e24\u90e8\u5206\uff0c\u80cc\u666f\u6761\u4ee5\u53ca\u5df2\u5b8c\u6210\u7684\u8fdb\u5ea6\u6761\u3002<\/p>\n<style>.params_table td{border:0;}<\/style>\n<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\" class=\"params_table\">\n<tr>\n<th scope=\"col\">\u6d4f\u89c8\u5668<\/th>\n<th colspan=\"3\" scope=\"col\">FireFox 18<\/th>\n<th colspan=\"4\" scope=\"col\">Chrome 23<\/th>\n<th colspan=\"3\" scope=\"col\">Opera 12<\/th>\n<th colspan=\"3\" scope=\"col\">IE 10<\/th>\n<\/tr>\n<tr>\n<th scope=\"row\">\u5143\u7d20\u533a\u57df<\/th>\n<td>\n<div align=\"center\">\u8fb9\u6846<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u5df2\u5b8c\u6210\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u8fb9\u6846<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u5916\u80cc\u666f<\/div>\n<\/td>\n<td style=\"background-color:#eee;\">\n<div align=\"center\">\u5185\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u5df2\u5b8c\u6210\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u8fb9\u6846<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u5df2\u5b8c\u6210\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u8fb9\u6846<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u80cc\u666f<\/div>\n<\/td>\n<td>\n<div align=\"center\">\u5df2\u5b8c\u6210\u80cc\u666f<\/div>\n<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">{border:*;}<\/th>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td style=\"background-color:#eee;\">&nbsp;<\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">{background:*;}<\/th>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td style=\"background-color:#eee;\">&nbsp;<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">{color:*;}<\/th>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\" style=\"color:#999;\">\u4e0d\u652f\u6301<\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td style=\"background-color:#eee;\">&nbsp;<\/td>\n<td>\n<div align=\"center\" style=\"color:#999;\">\u4e0d\u652f\u6301<\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\" style=\"color:#999;\">\u4e0d\u652f\u6301<\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">::-prefix-progress-value{background:*;}<\/th>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" alt=\"\u4e0d\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td style=\"background-color:#eee;\">&nbsp;<\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" alt=\"\u4e0d\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" alt=\"\u4e0d\u652f\u6301\" \/><\/div>\n<\/td>\n<\/tr>\n<tr>\n<th scope=\"row\">::-prefix-progress-bar{background:*;}<\/th>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td style=\"background-color:#eee;\">\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/ok.gif\" alt=\"\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" alt=\"\u4e0d\u652f\u6301\" \/><\/div>\n<\/td>\n<td><\/td>\n<td><\/td>\n<td>\n<div align=\"center\"><img decoding=\"async\" src=\"\/study\/image\/error.gif\" alt=\"\u4e0d\u652f\u6301\" \/><\/div>\n<\/td>\n<\/tr>\n<\/table>\n<p><strong>\u7ed3\u8bba\uff1a<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528<code>progress{border:*; background:*;}<\/code>\u53ef\u4ee5\u63a7\u5236\u6240\u6709\u6d4f\u89c8\u5668\u4e0bprogress\u5143\u7d20\u7684\u8fb9\u6846\u548c\u80cc\u666f\u8272\u3002\u5176\u4e2d\uff0cChrome\u6d4f\u89c8\u5668\u662f\u4e2a\u7279\u4f8b\uff0c\u76f4\u63a5\u7684\u8bbe\u7f6e\u770b\u4e0d\u5230\u6548\u679c\uff08\u5b9e\u9645\u4e0a\u652f\u6301\uff09\uff0c\u539f\u56e0\u4e0b\u9762\u4f1a\u89e3\u91ca\u3002<\/li>\n<li><strong>FireFox\u6d4f\u89c8\u5668<\/strong><br \/>\n\u5df2\u7ecf\u5b8c\u6210\u7684\u8fdb\u5ea6\u6761\uff0c\u4f7f\u7528<code>progress::-moz-progress-bar { }<\/code>\u8868\u793a\uff0c\u8fd9\u4e0eChrome\u6d4f\u89c8\u5668\u662f\u76f8\u53cd\u7684\u3002<\/li>\n<li><strong>Chrome\u6d4f\u89c8\u5668<\/strong><br \/>\nChrome\u7684\u8868\u73b0\u4e0eFireFox\u6709\u7740\u660e\u663e\u7684\u5dee\u5f02\uff0c\u5176<code>progress<\/code>\u5143\u7d20\u7684\u7ed3\u6784\u4f3c\u4e4e\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<pre style=\"margin:8px 0; line-height:20px;\">progress\u2513\r\n    progress-value\r\n    progress-bar<\/pre>\n<p>\u5176\u4e2d\uff0c<code>progress-bar<\/code>\u6307\u5168\u90e8\u7684\u8fdb\u5ea6\uff0c<code>progress-value<\/code>\u6307\u5df2\u7ecf\u5b8c\u6210\u7684\u8fdb\u5ea6\u3002\u56e0\u6b64\uff0cChrome\u6d4f\u89c8\u5668\u4e0b\uff0c\u5df2\u7ecf\u5b8c\u6210\u7684\u8fdb\u5ea6\u6761\uff0c\u4f7f\u7528<code>progress::-webkit-progress-value { }<\/code>\u8868\u793a\uff0c FireFox\u6d4f\u89c8\u5668\u4e0b\u662f<code>*-bar<\/code>. \u800c<code>progress-bar<\/code>\u9ed8\u8ba4\u542b\u6709\u80cc\u666f\u8272\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u9700\u8981\u5982\u4e0b\u8bbe\u7f6e\uff0c\u4ee5\u81ea\u5b9a\u4e49\u80cc\u666f\u8272\uff1a<br \/>\n<code>progress::-webkit-progress-bar { background: *; }<\/code><br \/>\n\u8fd9\u4e5f\u5f88\u597d\u5730\u89e3\u91ca\u4e86\u4e0a\u9762\u7684\u4e00\u4e2a\u7591\u95ee\uff1f<code>progress{background:*\uff1b}<\/code>\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u8ba9<code>progress<\/code>\u5143\u7d20\u80cc\u666f\u8272\u6539\u53d8\u5462\uff1f\u4e0d\u662f\u4e0d\u80fd\u6539\u53d8\uff0c\u800c\u662f\u88ab<code>progress-bar<\/code>\u8fd9\u4e2a\u5185\u90e8\u5143\u7d20\u7ed9\u8986\u76d6\u4e86\uff0c\u5f53\u6211\u4eec\u8bbe\u7f6e\uff1a<code>progress::-webkit-progress-bar { background: transparent; }<\/code>\u7684\u65f6\u5019\uff0c<code>progress{background:*\uff1b}<\/code>\u8bbe\u7f6e\u7684\u80cc\u666f\u8272\u5c31\u4f1a\u663e\u9732\u51fa\u6765\u3002<\/li>\n<p><strong>\u65b0\u589e\u4e8e2017-09-26<\/strong><br \/>\n\u5bf9\u4e8eChrome\u7b49\u6d4f\u89c8\u5668\uff0c\u5982\u679c\u5e0c\u671b\u8fdb\u5ea6\u6761\u662f\u5706\u89d2\uff0c\u53ef\u4ee5\u8fd9\u4e48\u5904\u7406\uff1a<\/p>\n<pre>progress::-webkit-progress-inner-element { border-radius: 4px; }\r\nprogress::-webkit-progress-value { border-radius: 4px; }\r\nprogress::-webkit-progress-bar { border-radius: 4px; } <\/pre>\n<p><strong>\u66f4\u65b0\u4e8e2019-10-17<\/strong><br \/>\n\u6d4f\u89c8\u5668\u5706\u89d2\u73b0\u5728\u4e0d\u9700\u8981\u4e0a\u9762\u8fd9\u4e48\u9ebb\u70e6\u4e86\uff0c\u76f4\u63a5\u4e0b\u9762\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n<pre>progress {\r\n    border-radius: 1em;\r\n    overflow: hidden;\r\n}<\/pre>\n<li><strong>Opera\u6d4f\u89c8\u5668<\/strong><br \/>\nOpera\u4f3c\u4e4e\u6ca1\u6709\u4ec0\u4e48<code>::-o-progress-*{}<\/code>\u7684\u7528\u6cd5\uff0c\u56e0\u6b64\uff0cOpera\u6d4f\u89c8\u5668\uff0c\u5176\u5df2\u5b8c\u6210\u8fdb\u5ea6\u7684\u80cc\u666f\u8272\u662f\u65e0\u89e3\u7684\uff0c\u53ea\u80fd\u4f7f\u7528\u9ed8\u8ba4\u7684\u989c\u8272\u2014\u2014\u6211\u7684\u6d4f\u89c8\u5668\u662f\u548c\u8c10\u7eff\u8272\u3002<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_175814.png\" width=\"229\" height=\"85\" alt=\"Opera\u6d4f\u89c8\u5668\u4e0b\u7684\u7eff\u8272\u5df2\u5b8c\u6210\u8fdb\u5ea6\u80cc\u666f\u8272\" class=\"alignnone\" \/><\/li>\n<li><strong>IE10\u6d4f\u89c8\u5668<\/strong><br \/>\nIE10\u6d4f\u89c8\u5668\u5f88\u5947\u8469\u7684\uff0c\u5b83\u4e5f\u53ef\u4ee5\u8bbe\u7f6e\u5df2\u5b8c\u6210\u8fdb\u5ea6\u7684\u80cc\u666f\u8272\uff0c\u4f7f\u7528\u7684\u662f<code>color<\/code>\u5c5e\u6027\uff0c<code>progress{color:*;}<\/code> <img decoding=\"async\" src=\"https:\/\/mat1.gtimg.com\/www\/mb\/images\/face\/98.gif\">\u3002<\/p>\n<p><strong>\u66f4\u65b0\u4e8e2019-10-17<\/strong><br \/>\n\u6709\u4eba\u53cd\u9988IE\u6d4f\u89c8\u5668\u4e0b\u6709\u4e2a\u9ed1\u8272\u8fb9\u6846\u7ebf\u6846\uff0c\u53ef\u4ee5\u4f7f\u7528\u4e0b\u9762\u4ee3\u7801\u53bb\u9664\uff1a<\/p>\n<pre>.ui-progress::-ms-fill {\r\n    border: none;\r\n}<\/pre>\n<p>\u5982\u679c\u60f3\u8981\u517c\u5bb9IE9\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u4e2apolyfill\uff1a<a href=\"https:\/\/github.com\/LeaVerou\/HTML5-Progress-polyfill\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/LeaVerou\/HTML5-Progress-polyfill<\/a><\/p>\n<p>\u4e0a\u9762\u7684polyfill\u9ed8\u8ba4CSS\u6837\u5f0f\u592a\u8fc7\u65f6\u4e86\uff0c\u4f7f\u7528\u7eaf\u8272\u7684\u8bdd\u53ea\u8981\u4e0b\u9762CSS\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n<pre>\/* IE9 polyfill *\/\r\n.ui-progress[role] {\r\n    display: inline-block;\r\n    width: 10em; height: 1em;\r\n    vertical-align: -.2em;\r\n    position: relative;\r\n    box-sizing: border-box;\r\n}\r\n\r\n.ui-progress[aria-valuenow]::before {\r\n    background-color: #0064B4;\r\n}\r\n\r\n\/* Determinate only overrides *\/\r\n.ui-progress[aria-valuenow] {\r\n    background: #e6e6e6;\r\n}\r\n\r\n.ui-progress[aria-valuenow]::before {\r\n    content: '';\r\n    display: block;\r\n    height: 100%;\r\n}<\/pre>\n<\/li>\n<\/ol>\n<p>\u56e0\u6b64\uff0c\u7efc\u4e0a\u5168\u90e8\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u7c7b\u4f3c\u4e0b\u9762\u7684CSS\u5b9e\u73b0\u6700\u5927\u517c\u5bb9\u7684\u81ea\u5b9a\u4e49\u8fdb\u5ea6\u6761\u6837\u5f0f\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>progress {\r\n    width: 160px;\r\n    border: 1px solid #0064B4;  \r\n    background-color:#e6e6e6;\r\n    color: #0064B4; <span style=\"color:green;\">\/*IE10*\/<\/span>\r\n}\r\n\r\nprogress::-moz-progress-bar { background: #0064B4; }\r\nprogress::-webkit-progress-bar { background: #e6e6e6; }\r\nprogress::-webkit-progress-value  { background: #0064B4; }<\/pre>\n<\/div>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201302\/progress.html\" target=\"_blank\" class=\"a_link\">progress\u5143\u7d20\u6837\u5f0f\u81ea\u5b9a\u4e49\u6700\u5927\u517c\u5bb9demo<\/a><\/p>\n<h3>\u4e09\u3001\u5b9e\u4f8b\u6548\u679c\u5c55\u793a<\/h3>\n<p>\u8fdb\u5ea6\u6761\u53ef\u4ee5\u7528\u5728\u9875\u9762loading\u4e2d\uff08\u5982gmail\uff09\uff0c\u6216\u8005\u6587\u4ef6\u4e0a\u4f20\u8fdb\u5ea6\uff0c\u6216\u8005\u89c6\u9891\u64ad\u653e\u8fdb\u5ea6\u7b49\u3002<\/p>\n<p>\u4e3a\u6f14\u793a\u4e0a\u9762\u7684\u81ea\u5b9a\u4e49\u6837\u5f0f\uff0c\u73b0\u5728\u6574\u5408\u6211\u4e4b\u524d\u6298\u817e\u7684<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=1923\">HTML5\u6587\u4ef6\u4e0a\u4f20<\/a>\uff0c\u505a\u4e86\u4e2ademo\u3002<\/p>\n<p>\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201302\/html5-image-upload-progress-style.html\" target=\"_blank\" class=\"a_link\">\u6587\u4ef6\u4e0a\u4f20\u8fdb\u5ea6\u4e0eprogress\u5143\u7d20\u7684\u6837\u5f0f\u63a7\u5236demo<\/a> <\/p>\n<p>\u9009\u62e9\u4e00\u4e2a\u56fe\u7247\uff08\u53ef\u4ee5\u5927\u4e00\u70b9\u7684\uff09\uff0c\u7136\u540e\u70b9\u51fb\u6309\u94ae\u4e0a\u4f20\uff08\u6700\u597d\u53ef\u4ee5\u9650\u901f\uff09\uff0c\u5c31\u53ef\u4ee5\u6e05\u695a\u770b\u5230\u8fdb\u5ea6\u53d8\u5316\uff0c\u5982\u4e0b\u622a\u56fe\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_191040.png\" width=\"530\" height=\"444\" alt=\"\u56fe\u7247\u4e0a\u4f20\u8fdb\u5ea6\u4e2d\u2026\u2026\" class=\"alignnone\" \/><\/p>\n<p>\u5173\u952e\u90e8\u5206\u7684\u4ee3\u7801\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>onProgress: function(file, loaded, total) {\r\n    var percent = Math.round(loaded \/ total * 100);\r\n    <span style=\"color:#cd0000;\">$(\"progress\").val(percent);<\/span>\r\n}<\/pre>\n<\/div>\n<p>\u76f4\u63a5value\u8d4b\u503c\u5c31\u6709\u4e86\u8fdb\u5ea6\u52a8\u753b\u6548\u679c\u3002\u4f20\u7edf\u5b9e\u73b0\u9700\u8981<code>div<\/code>\u5d4c\u5957\uff0c\u4ee5\u53ca<code>width<\/code>\u63a7\u5236\u7b49\u3002\u4f18\u52a3\u4f2f\u4ef2\uff0c\u4e00\u76ee\u4e86\u7136\u3002<\/p>\n<h3>\u56db\u3001\u6de1\u6de1\u7684\u7ed3\u675f\u8bed<\/h3>\n<p>\u5403\u4e86\u4e2a\u665a\u996d\uff0c\u4e0d\u8bb0\u5f97\u539f\u672c\u60f3\u8981\u8bb2\u7684\u7ed3\u675f\u8bed\u4e86\u3002\u60f3\u60f3~~\u6069\u2026\u2026IE6~IE9\u6d4f\u89c8\u5668\u4e0d\u652f\u6301<code>progress<\/code>\u5143\u7d20\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u5d4c\u5957\u5176\u4ed6\u5143\u7d20\u7684\u65b9\u6cd5\u8fdb\u884c\u517c\u5bb9\uff0c\u4f8b\u5982\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;progress>&lt;div>\u8fd9\u91cc\u5199\u517c\u5bb9IE\u7684\u4e1c\u4e1c&lt;\/div>&lt;\/progress><\/pre>\n<\/div>\n<p>\u652f\u6301<code>progress<\/code>\u7684\u6d4f\u89c8\u5668\u4f1a\u5ffd\u7565<code>innerHTML<\/code>\uff0c\u56e0\u6b64\uff0c\u5185\u90e8\u7684<code>div<\/code>\u53ef\u4ee5\u653e\u5fc3\u5927\u80c6\u8fdb\u884c\u6837\u5f0f\u5904\u7406\uff0c\u517c\u5bb9\u4f4e\u7248\u672cIE\u6d4f\u89c8\u5668\u3002<\/p>\n<p><strong>\u597d\u7684\u517c\u5bb9\u505a\u6cd5<\/strong><br \/>\n\u5bf9\u4e8eIE6~IE9\u6d4f\u89c8\u5668\uff0c\u6a21\u62df\u8fdb\u5ea6\u6761\u6548\u679c\uff0c\u5982\u679c\u4e0d\u4f7f\u7528\u80cc\u666f\u56fe\u7247\u7684\u8bdd\uff0c\u4e00\u822c\u800c\u8a00\uff0c\u81f3\u5c11\u9700\u89812\u5c42\u6807\u7b7e\u3002\u6211\u4eec\u9700\u8981\u518d\u989d\u5916\u7684\u5f92\u589e2\u5c42\u6807\u7b7e\uff1f\uff1fNo, no, no! \u5916\u90e8\u7684<code>progress<\/code>\u6807\u7b7e\u5df2\u7ecf\u66ff\u6211\u4eec\u505a\u4e86\u4e00\u534a\u7684\u5de5\u4f5c\uff0c\u56e0\u4e3a\uff0c<code>progress<\/code>\u6240\u5bf9\u5e94\u7684CSS\u6837\u5f0f\uff0c\u4e5f\u662fIE6~9\u6d4f\u89c8\u5668\u9700\u8981\u7684\uff08\u9ad8\u5bbd\uff0c\u8fb9\u6846\u8272\u80cc\u666f\u8272\u4ec0\u4e48\u7684\uff09\uff0c\u56e0\u6b64\uff0c\u6211\u4eec\u53ea\u9700\u8981\u518d\u989d\u5916\u585e1\u5c42\u6807\u7b7e\u5c31\u53ef\u4ee5\u4e86\uff0c\u8fd9\u4e2a\u6807\u7b7e\u5bf9\u5e94\u7684\u5c31\u662f\u5df2\u7ecf\u5b8c\u6210\u7684\u8fdb\u5ea6\u6761\u7684\u6837\u5f0f\u3002<\/p>\n<p>\u4f8b\u5982\uff0c\u5982\u4e0b\u7684HTML\u8bbe\u7f6e\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>&lt;progress max=\"100\" value=\"20\">&lt;ie style=\"width:20%;\">&lt;\/ie>&lt;\/progress><\/pre>\n<\/div>\n<p>\u6211\u4eec\u9700\u8981\u600e\u6837\u7684CSS\u4ee3\u7801\u5462\uff1f\u5982\u4e0b\uff0c\u6807\u7ea2\u7684\u90e8\u5206\u4e0e\u517c\u5bb9\u5904\u7406\u6240\u589e\u52a0\u7684\uff0c\u90fd\u662f\u65e0\u4f24\u5927\u96c5\uff0c\u4e0d\u9700\u8981hack\u8865\u4e01\u7684\u3002<\/p>\n<div class=\"zxx_code\">\n<pre>progress {\r\n    <span style=\"color:#cd0000;\">display: inline-block;<\/span>\r\n    width: 160px;\r\n    height: 20px;\r\n    border: 1px solid #0064B4;  \r\n    background-color:#e6e6e6;\r\n    color: #0064B4; <span style=\"color:green;\">\/*IE10*\/<\/span>\r\n}\r\n<span style=\"color:green;\">\/*ie6-ie9*\/<\/span>\r\n<span style=\"color:#cd0000;\">progress ie {\r\n    display:block;\r\n    height: 100%;\r\n    background: #0064B4;\r\n}<\/span>\r\n\r\nprogress::-moz-progress-bar { background: #0064B4; }\r\nprogress::-webkit-progress-bar { background: #e6e6e6; }\r\nprogress::-webkit-progress-value  { background: #0064B4; }<\/pre>\n<\/div>\n<p>\u5f53\u7136\uff0c<code>progress<\/code>\u4ee5\u53ca\u81ea\u5b9a\u4e49\u7684<code>ie<\/code>\u5143\u7d20\uff0cie6~8\u90fd\u662f\u4e0d\u8ba4\u8bc6\u7684\uff0c\u6211\u4eec\u9700\u8981\u6253\u4e2a\u52a8\u6001\u8865\u4e01\uff0c\u5982\u4e0b\uff1a<\/p>\n<div class=\"zxx_code\">\n<pre>if (typeof window.screenX !== \"number\") {\r\n    document.createElement(\"progress\");\t\r\n    document.createElement(\"ie\");\t\r\n}<\/pre>\n<\/div>\n<p>\u4e8e\u662f\uff0c<code>progress{}<\/code>, <code>ie{}<\/code>\u7684\u6837\u5f0f\u5c31\u80fd\u88ab\u4f4e\u7248\u672cIE\u8bc6\u522b\uff0c\u540c\u65f6\uff0c\u5355\u7eaf\u4f5c\u4e3a\u666e\u901a\u5143\u7d20\u5904\u7406\uff08\u73b0\u4ee3\u6d4f\u89c8\u5668\u5219\u4f1a\u628a<code>ie<\/code>\u6807\u7b7e\u76f4\u63a5\u62b9\u6740\uff09\u3002<\/p>\n<p>\u8033\u542c\u4e3a\u865a\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/study\/201302\/progress-compatible-ie6-ie9.html\" target=\"_blank\" class=\"a_link\">progress\u5143\u7d20\u517c\u5bb9IE6~IE9 demo<\/a><\/p>\n<p>\u4f8b\u5982\uff0cIE6\u6d4f\u89c8\u5668\u4e0b\uff0c\u5c31\u662f\u4e0b\u9762\u8fd9\u4e2a\u6837\u5b50\uff1a<br \/>\n<img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/image.zhangxinxu.com\/image\/blog\/201302\/2013-02-21_205006.png\" width=\"271\" height=\"138\" alt=\"IE6\u6d4f\u89c8\u5668\u4e0b\u8fdb\u5ea6\u6761\u6548\u679c\u793a\u610f\" class=\"alignnone\" \/><\/p>\n<p>\u5982\u73b0\u4ee3\u6d4f\u89c8\u5668\u4eec\u957f\u5f97\u4e00\u4e2a\u6a21\u6837\u3002\u56e0\u6b64\uff0c\u76ee\u524d\uff0c\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u4f7f\u7528<code>progress<\/code>\u5143\u7d20\u662f\u5b8c\u5168\u53ef\u884c\u7684\uff0c\u4f60\u8fd8\u4e0d\u8d76\u5feb\u8bd5\u8bd5\uff01<\/p>\n<p>\u53c2\u8003\u6587\u7ae0\uff1a<a href=\"http:\/\/html5doctor.com\/the-progress-element\/\">The progress element<\/a><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u81ea<a href=\"http:\/\/www.zhangxinxu.com\/\">\u5f20\u946b\u65ed-\u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<\/a>[<a href=\"http:\/\/www.zhangxinxu.com\/\">http:\/\/www.zhangxinxu.com<\/a>]<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"http:\/\/www.zhangxinxu.com\/wordpress\/?p=3034\">http:\/\/www.zhangxinxu.com\/wordpress\/?p=3034<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u9898\uff0c\u672c\u6587\u7740\u91cd\u8bb2\u89e3HTML5 progress\u5143\u7d20\u7684\u4e00\u4e9b\u76f8\u5173\u4e1c\u897f\uff0c\u4ee5\u4fbf\u60a8\u53ef\u4ee5\u5728\u5b9e\u9645\u9879\u76ee\u4e2d\u5e94\u7528\u3002\u4e00\u5982\u65e2\u5f80\uff0c\u591a\u591ademo\uff0c\u591a\u591a\u622a\u56fe\uff0c\u5fc5\u8981\u7684\u6e90\u4ee3\u7801\u5c55\u793a\u3002\u603b\u4e4b\uff0c\u5e0c\u671b\u672c\u6587\u7684\u5185\u5bb9\u80fd\u591f\u5bf9\u60a8\u7684\u5b66\u4e60\u6216\u5de5\u4f5c\u6709\u6240\u5e2e\u52a9\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1097],"tags":[52,132,780,140,221],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/3034"}],"collection":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/comments?post=3034"}],"version-history":[{"count":0,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/3034\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=3034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=3034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=3034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}