{"id":846,"date":"2025-12-22T08:58:46","date_gmt":"2025-12-22T00:58:46","guid":{"rendered":"https:\/\/www.52runoob.com\/?p=846"},"modified":"2025-12-22T08:58:46","modified_gmt":"2025-12-22T00:58:46","slug":"%e5%a6%82%e4%bd%95%e9%80%9a%e8%bf%87html-css-%e5%ae%9e%e7%8e%b0%e5%90%84%e7%b1%bb%e8%bf%9b%e5%ba%a6%e6%9d%a1%e7%9a%84%e5%8a%9f%e8%83%bd-3","status":"publish","type":"post","link":"https:\/\/www.52runoob.com\/index.php\/2025\/12\/22\/%e5%a6%82%e4%bd%95%e9%80%9a%e8%bf%87html-css-%e5%ae%9e%e7%8e%b0%e5%90%84%e7%b1%bb%e8%bf%9b%e5%ba%a6%e6%9d%a1%e7%9a%84%e5%8a%9f%e8%83%bd-3\/","title":{"rendered":"\u5982\u4f55\u901a\u8fc7HTML\/CSS \u5b9e\u73b0\u5404\u7c7b\u8fdb\u5ea6\u6761\u7684\u529f\u80fd"},"content":{"rendered":"\n<p>\u5728 HTML\/CSS \u4e2d\u5b9e\u73b0\u5404\u7c7b\u8fdb\u5ea6\u6761\uff08\u6761\u5f62\u3001\u5706\u5f62\u3001\u6ce2\u6d6a\u3001\u6761\u7eb9\u52a8\u753b\u7b49\uff09\u975e\u5e38\u5e38\u89c1\uff0c\u73b0\u4ee3\u6d4f\u89c8\u5668\uff082025 \u5e74\uff09\u652f\u6301\u4e30\u5bcc\u7684 CSS \u7279\u6027\uff08\u5982 conic-gradient\u3001linear-gradient\u3001animation\u3001clip-path \u7b49\uff09\uff0c\u53ef\u4ee5\u5b9e\u73b0\u7eaf CSS \u6216\u7b80\u5355 JS \u63a7\u5236\u7684\u5404\u79cd\u6548\u679c\u3002\u4e0b\u9762\u6309\u5e38\u89c1\u7c7b\u578b\u5206\u7c7b\u6574\u7406\uff0c\u5305\u542b\u5b8c\u6574\u4ee3\u7801\u548c\u8bf4\u660e\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u590d\u5236\u4f7f\u7528\u30021. \u6700\u57fa\u7840\u6761\u5f62\u8fdb\u5ea6\u6761\uff08div + width\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;progress-bar-container&quot;&gt;\n  &amp;lt;div class=&quot;progress-bar&quot; style=&quot;width: 75%;&quot;&gt;&amp;lt;\/div&gt;\n&amp;lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.progress-bar-container {\n  width: 100%;\n  height: 20px;\n  background: #e0e0e0;\n  border-radius: 10px;\n  overflow: hidden;\n}\n\n.progress-bar {\n  height: 100%;\n  background: linear-gradient(90deg, #4facfe, #00f2fe);\n  transition: width 0.6s ease;\n  border-radius: 10px;\n}\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1a\u901a\u8fc7\u5185\u8054 style=&#8221;width: xx%&#8221; \u6216 JS \u4fee\u6539\u5bbd\u5ea6\u5b9e\u73b0\u52a8\u6001\u8fdb\u5ea6\u30022. \u6761\u7eb9\u52a8\u753b\u8fdb\u5ea6\u6761\uff08\u7ecf\u5178 loading \u6548\u679c\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;progress striped animated&quot;&gt;\n  &amp;lt;div class=&quot;progress-fill&quot; style=&quot;width: 85%;&quot;&gt;&amp;lt;\/div&gt;\n&amp;lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.progress {\n  width: 100%;\n  height: 24px;\n  background: #e0e0e0;\n  border-radius: 12px;\n  overflow: hidden;\n}\n\n.progress-fill {\n  height: 100%;\n  background: linear-gradient(\n    45deg,\n    #4caf50 25%,\n    transparent 25%,\n    transparent 50%,\n    #4caf50 50%,\n    #4caf50 75%,\n    transparent 75%,\n    transparent\n  );\n  background-size: 40px 40px;\n  animation: stripe 2s linear infinite;\n}\n\n@keyframes stripe {\n  0% { background-position: 0 0; }\n  100% { background-position: 40px 0; }\n}\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1a\u4f7f\u7528 background-position \u52a8\u753b\u5b9e\u73b0\u6761\u7eb9\u6d41\u52a8\u611f\u30023. \u5706\u5f62\u8fdb\u5ea6\u6761\uff08\u73b0\u4ee3 conic-gradient \u5b9e\u73b0\uff0c\u63a8\u8350\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;circle-progress&quot; data-percent=&quot;72&quot;&gt;\n  &amp;lt;div class=&quot;percent&quot;&gt;72%&amp;lt;\/div&gt;\n&amp;lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.circle-progress {\n  width: 180px;\n  height: 180px;\n  border-radius: 50%;\n  background: conic-gradient(#4caf50 0% calc(var(--percent) * 1%), #e0e0e0 calc(var(--percent) * 1%) 100%);\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: relative;\n  box-shadow: inset 0 0 20px rgba(0,0,0,0.1);\n}\n\n.circle-progress::before {\n  content: &quot;&quot;;\n  position: absolute;\n  width: 80%;\n  height: 80%;\n  background: white;\n  border-radius: 50%;\n}\n\n.percent {\n  font-size: 2.5rem;\n  font-weight: bold;\n  color: #4caf50;\n  z-index: 1;\n}\n<\/pre><\/div>\n\n\n<p>JS \u52a8\u6001\u8bbe\u7f6e\uff1a<\/p>\n\n\n\n<p>javascript<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocument.querySelectorAll(&#039;.circle-progress&#039;).forEach(el =&gt; {\n  const percent = el.dataset.percent;\n  el.style.setProperty(&#039;--percent&#039;, percent);\n});\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1aconic-gradient \u662f\u73b0\u4ee3\u6d4f\u89c8\u5668\uff08Chrome 84+\u3001Safari 14+\u3001Firefox 83+\uff09\u652f\u6301\u7684\u5706\u9525\u6e10\u53d8\uff0c\u975e\u5e38\u9002\u5408\u5706\u5f62\u8fdb\u5ea6\u6761\u30024. \u5706\u5f62\u8fdb\u5ea6\u6761 + \u52a8\u753b\uff08\u4ece 0% \u589e\u957f\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;circle-progress&quot; data-percent=&quot;85&quot; id=&quot;animated-circle&quot;&gt;&amp;lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.circle-progress {\n  width: 200px;\n  height: 200px;\n  border-radius: 50%;\n  background: conic-gradient(#2196f3 0deg, #2196f3 var(--progress), #e0e0e0 var(--progress) 100%);\n  position: relative;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  font-size: 2.8rem;\n  font-weight: bold;\n  color: #2196f3;\n}\n\n.circle-progress::before {\n  content: &quot;&quot;;\n  width: 85%;\n  height: 85%;\n  background: white;\n  border-radius: 50%;\n  position: absolute;\n}\n<\/pre><\/div>\n\n\n<p>javascript<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n\/\/ \u4ece 0% \u52a8\u753b\u5230\u76ee\u6807\u503c\nconst circle = document.getElementById(&#039;animated-circle&#039;);\nconst target = parseInt(circle.dataset.percent);\nlet current = 0;\n\nconst interval = setInterval(() =&gt; {\n  current += 1;\n  circle.style.setProperty(&#039;--progress&#039;, current + &#039;deg&#039;);\n  circle.textContent = current + &#039;%&#039;;\n  if (current &gt;= target) clearInterval(interval);\n}, 30);\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1a\u6bcf 30ms \u9012\u589e 1%\uff0c\u5b9e\u73b0\u5e73\u6ed1\u52a8\u753b\u30025. \u6ce2\u6d6a\u7403\u5f62\u8fdb\u5ea6\u6761\uff08\u6c34\u7403\u6548\u679c\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;div class=&quot;wave-progress&quot; data-percent=&quot;68&quot;&gt;\n  &amp;lt;div class=&quot;wave&quot;&gt;&amp;lt;\/div&gt;\n  &amp;lt;div class=&quot;wave&quot;&gt;&amp;lt;\/div&gt;\n  &amp;lt;div class=&quot;percent&quot;&gt;68%&amp;lt;\/div&gt;\n&amp;lt;\/div&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n.wave-progress {\n  width: 200px;\n  height: 200px;\n  border-radius: 50%;\n  background: #fff;\n  overflow: hidden;\n  position: relative;\n  box-shadow: 0 0 20px rgba(0,0,0,0.2);\n}\n\n.wave {\n  position: absolute;\n  width: 400%;\n  height: 400%;\n  background: #2196f3;\n  border-radius: 45%;\n  top: 60%;\n  left: -150%;\n  animation: wave 12s linear infinite;\n  opacity: 0.6;\n}\n\n.wave:nth-child(2) {\n  animation-delay: -6s;\n  opacity: 0.4;\n}\n\n.percent {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  font-size: 3rem;\n  font-weight: bold;\n  color: white;\n  z-index: 10;\n  text-shadow: 0 2px 4px rgba(0,0,0,0.5);\n}\n\n@keyframes wave {\n  0% { transform: translateX(0) rotate(0deg); }\n  100% { transform: translateX(50%) rotate(360deg); }\n}\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1a\u5229\u7528 border-radius + transform \u52a8\u753b\u5b9e\u73b0\u6ce2\u6d6a\uff0c\u63a7\u5236 top \u503c\u53ef\u52a8\u6001\u8c03\u6574\u6c34\u4f4d\uff08\u9700 JS\uff09\u30026. \u4f7f\u7528 HTML \u539f\u751f\u5143\u7d20\uff08\u7b80\u5355\u573a\u666f\uff09<\/p>\n\n\n\n<p>html<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n&amp;lt;!-- \u666e\u901a\u8fdb\u5ea6\u6761 --&gt;\n&amp;lt;progress value=&quot;75&quot; max=&quot;100&quot;&gt;75%&amp;lt;\/progress&gt;\n\n&amp;lt;!-- \u4eea\u8868\u76d8 --&gt;\n&amp;lt;meter value=&quot;68&quot; min=&quot;0&quot; max=&quot;100&quot; low=&quot;30&quot; high=&quot;80&quot; optimum=&quot;90&quot;&gt;68%&amp;lt;\/meter&gt;\n<\/pre><\/div>\n\n\n<p>css<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nprogress {\n  appearance: none;\n  width: 100%;\n  height: 20px;\n}\n\nprogress::-webkit-progress-bar {\n  background: #e0e0e0;\n  border-radius: 10px;\n}\n\nprogress::-webkit-progress-value {\n  background: #4caf50;\n  border-radius: 10px;\n}\n\nprogress::-moz-progress-bar {\n  background: #4caf50;\n  border-radius: 10px;\n}\n<\/pre><\/div>\n\n\n<p>\u8bf4\u660e\uff1a\u6d4f\u89c8\u5668\u517c\u5bb9\u6027\u8f83\u597d\uff0c\u4f46\u81ea\u5b9a\u4e49\u80fd\u529b\u6709\u9650\u30027. \u603b\u7ed3\u5bf9\u6bd4\u8868<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><th>\u7c7b\u578b<\/th><th>\u5b9e\u73b0\u65b9\u5f0f<\/th><th>\u4f18\u70b9<\/th><th>\u7f3a\u70b9<\/th><th>\u9002\u7528\u573a\u666f<\/th><\/tr><tr><td>\u57fa\u7840\u6761\u5f62<\/td><td>div + width<\/td><td>\u6700\u7b80\u5355\u3001\u517c\u5bb9\u6027\u6700\u597d<\/td><td>\u52a8\u753b\u9700 JS<\/td><td>\u6240\u6709\u573a\u666f<\/td><\/tr><tr><td>\u6761\u7eb9\u52a8\u753b<\/td><td>linear-gradient + animation<\/td><td>\u65e0\u9700 JS\uff0c\u7eaf CSS \u6d41\u52a8\u6548\u679c<\/td><td>\u6837\u5f0f\u8f83\u56fa\u5b9a<\/td><td>loading \/ \u4e0a\u4f20\u8fdb\u5ea6<\/td><\/tr><tr><td>\u5706\u5f62 (\u73b0\u4ee3)<\/td><td>conic-gradient<\/td><td>\u4ee3\u7801\u5c11\u3001\u52a8\u753b\u987a\u6ed1<\/td><td>\u8001\u6d4f\u89c8\u5668\u4e0d\u652f\u6301<\/td><td>\u4eea\u8868\u76d8\u3001\u6280\u80fd\u5c55\u793a<\/td><\/tr><tr><td>\u6ce2\u6d6a\u7403\u5f62<\/td><td>border-radius + animation<\/td><td>\u89c6\u89c9\u51b2\u51fb\u5f3a<\/td><td>\u6027\u80fd\u7a0d\u9ad8<\/td><td>\u5b58\u50a8\u4f7f\u7528\u7387\u3001\u7535\u6c60\u7b49<\/td><\/tr><tr><td>\u539f\u751f &lt;progress&gt;<\/td><td>HTML \u6807\u7b7e + CSS \u4f2a\u5143\u7d20<\/td><td>\u8bed\u4e49\u5316\u3001\u6613\u8bfb\u5c4f<\/td><td>\u8de8\u6d4f\u89c8\u5668\u6837\u5f0f\u4e0d\u7edf\u4e00<\/td><td>\u7b80\u5355\u9759\u6001\u8fdb\u5ea6<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>\u989d\u5916\u63d0\u793a\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5927\u591a\u6570\u573a\u666f\u5efa\u8bae\u7528 conic-gradient \u505a\u5706\u5f62\uff08\u73b0\u4ee3\u6d4f\u89c8\u5668\u5df2\u5168\u8986\u76d6\uff09\u3002<\/li>\n\n\n\n<li>\u9700\u8981\u52a8\u6001\u63a7\u5236\u8fdb\u5ea6\u65f6\uff0c\u901a\u5e38\u914d\u5408\u5c11\u91cf JS\uff08\u5982 setProperty\uff09\u3002<\/li>\n\n\n\n<li>\u60f3\u66f4\u70ab\u9177\uff1f\u53ef\u4ee5\u7ed3\u5408 SVG + &lt;circle> \u6216 Canvas\uff0c\u4f46\u7eaf CSS \u5df2\u7ecf\u80fd\u6ee1\u8db3 90% \u9700\u6c42\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u5982\u679c\u4f60\u6709\u7279\u5b9a\u6548\u679c\uff08\u5982\u591a\u8272\u6e10\u53d8\u30013D\u3001SVG \u7248\u7b49\uff09\uff0c\u544a\u8bc9\u6211\uff0c\u6211\u53ef\u4ee5\u518d\u63d0\u4f9b\u9488\u5bf9\u6027\u4ee3\u7801\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 HTML\/CSS \u4e2d\u5b9e\u73b0\u5404\u7c7b\u8fdb\u5ea6\u6761\uff08\u6761\u5f62\u3001\u5706\u5f62\u3001\u6ce2\u6d6a\u3001\u6761\u7eb9\u52a8\u753b\u7b49\uff09\u975e\u5e38\u5e38\u89c1\uff0c&#8230; <a class=\"more-link\" href=\"https:\/\/www.52runoob.com\/index.php\/2025\/12\/22\/%e5%a6%82%e4%bd%95%e9%80%9a%e8%bf%87html-css-%e5%ae%9e%e7%8e%b0%e5%90%84%e7%b1%bb%e8%bf%9b%e5%ba%a6%e6%9d%a1%e7%9a%84%e5%8a%9f%e8%83%bd-3\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-846","post","type-post","status-publish","format-standard","hentry","category-html-xhtml"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/846","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/comments?post=846"}],"version-history":[{"count":1,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/846\/revisions"}],"predecessor-version":[{"id":847,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/posts\/846\/revisions\/847"}],"wp:attachment":[{"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/media?parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/categories?post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.52runoob.com\/index.php\/wp-json\/wp\/v2\/tags?post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}