{"id":11363,"date":"2024-09-26T00:04:18","date_gmt":"2024-09-25T16:04:18","guid":{"rendered":"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11363"},"modified":"2026-01-23T17:05:06","modified_gmt":"2026-01-23T09:05:06","slug":"css-math-round-function","status":"publish","type":"post","link":"https:\/\/www.zhangxinxu.com\/wordpress\/2024\/09\/css-math-round-function\/","title":{"rendered":"\u65f6\u9694\u4e24\u5e74\uff0cChrome\u4e5f\u652f\u6301round\u7b49CSS\u6570\u5b66\u51fd\u6570\u4e86"},"content":{"rendered":"<p>by <a href=\"https:\/\/www.zhangxinxu.com\/\">zhangxinxu<\/a> from <a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11363\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11363<\/a> \u946b\u7a7a\u95f4-\u946b\u751f\u6d3b<br \/>\n\u672c\u6587\u6b22\u8fce\u5206\u4eab\u4e0e\u805a\u5408\uff0c\u5168\u6587\u8f6c\u8f7d\u5c31\u4e0d\u5fc5\u4e86\uff0c\u5c0a\u91cd\u7248\u6743\uff0c\u5708\u5b50\u5c31\u8fd9\u4e48\u5927\uff0c\u82e5\u6025\u7528\u53ef\u4ee5\u8054\u7cfb\u6388\u6743\u3002<\/p>\n<p><script>window.wxShareImgUrl = 'https:\/\/www.zhangxinxu.com\/study\/image\/share\/202409-css-round.jpg';<\/script><\/p>\n<style>.entry canvas{background:#eee;}<\/style>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/curve-cover.jpg\" width=\"480\" height=\"309\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright clip loading size-medium\" \/><\/p>\n<h3>\u4e00\u3001CSS\u53c8\u66f4\u5f3a\u4e86\u4e00\u70b9<\/h3>\n<p>\u597d\u6d88\u606f\uff0c\u65f6\u9694\u4e24\u5e74\uff0c\u539f\u672c\u4ec5Safari\u6d4f\u89c8\u5668\u652f\u6301\u7684<code>mod()<\/code>\/<code>rem()<\/code>\/<code>round()<\/code>\u73b0\u5728Chrome\u6d4f\u89c8\u5668\u4e5f\u652f\u6301\u5566\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/2024-09-23_232327.png\" width=\"626\" height=\"222\" alt=\"\u6570\u5b66\u51fd\u6570\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<h4>mod()\u51fd\u6570<\/h4>\n<p>CSS mod()\u51fd\u6570\u8fd4\u56de\u7b2c\u4e00\u4e2a\u53c2\u6570\u9664\u4ee5\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7684\u53d6\u6a21\u7ed3\u679c\uff0c\u7c7b\u4f3c\u4e8eJavaScript\u4f59\u6570\u8fd0\u7b97\u7b26\uff08%\uff09\u3002<\/p>\n<p>\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>\/* \u6570\u503c\uff0c\u65e0\u5355\u4f4d *\/\r\nline-height: mod(7, 2); \/* 1 *\/\r\nline-height: mod(14, 5); \/* 4 *\/\r\nline-height: mod(3.5, 2); \/* 1.5 *\/\r\n\r\n\/* \u767e\u5206\u6bd4\u6216\u8005\u5e26\u5355\u4f4d\u7684\u5c3a\u5bf8 *\/\r\nmargin: mod(15%, 2%); \/* 1% *\/\r\nmargin: mod(18px, 4px); \/* 2px *\/\r\nmargin: mod(19rem, 5rem); \/* 4rem *\/\r\nmargin: mod(29vmin, 6vmin); \/* 5vmin *\/\r\nmargin: mod(1000px, 29rem); \/* 72px - \u5982\u679c\u6839\u5b57\u53f7\u662f16px *\/\r\n\r\n\/* \u6b63\u8d1f\u503c *\/\r\nrotate: mod(100deg, 30deg); \/* 10deg *\/\r\nrotate: mod(135deg, -90deg); \/* -45deg *\/\r\nrotate: mod(-70deg, 20deg); \/* 10deg *\/\r\nrotate: mod(-70deg, -15deg); \/* -10deg *\/\r\n\r\n\/* \u8ba1\u7b97*\/\r\nscale: mod(10 * 2, 1.7); \/* 1.3 *\/\r\nrotate: mod(10turn, 18turn \/ 3); \/* 4turn *\/\r\ntransition-duration: mod(20s \/ 2, 3000ms * 2); \/* 4s *\/<\/pre>\n<p>\u8fd9\u4e2aCSS\u51fd\u6570\u65e5\u5e38\u5f00\u53d1\u4f7f\u7528\u7684\u673a\u4f1a\u5e76\u4e0d\u5927\u3002<\/p>\n<h4>rem()\u51fd\u6570<\/h4>\n<p>CSS <code>rem()<\/code>\u51fd\u6570\u8fd4\u56de\u7b2c\u4e00\u4e2a\u53c2\u6570\u9664\u4ee5\u7b2c\u4e8c\u4e2a\u53c2\u6570\u540e\u7684\u4f59\u6570\uff0c\u7c7b\u4f3c\u4e8eJavaScript\u4f59\u6570\u8fd0\u7b97\u7b26\uff08%\uff09\u3002<\/p>\n<p>\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>\/* U\u6570\u503c\uff0c\u65e0\u5355\u4f4d *\/\r\nline-height: rem(21, 2); \/* 1 *\/\r\nline-height: rem(14, 5); \/* 4 *\/\r\nline-height: rem(5.5, 2); \/* 1.5 *\/\r\n\r\n\/* \u767e\u5206\u6bd4\u6216\u8005\u5e26\u5355\u4f4d\u7684\u5c3a\u5bf8 *\/\r\nmargin: rem(14%, 3%); \/* 2% *\/\r\nmargin: rem(18px, 5px); \/* 3px *\/\r\nmargin: rem(10rem, 6rem); \/* 4rem *\/\r\nmargin: rem(26vmin, 7vmin); \/* 5vmin *\/\r\nmargin: rem(1000px, 29rem); \/* 72px - if root font-size is 16px *\/\r\n\r\n\/* \u6b63\u8d1f\u503c *\/\r\nrotate: rem(200deg, 30deg); \/* 20deg *\/\r\nrotate: rem(140deg, -90deg); \/* 50deg *\/\r\nrotate: rem(-90deg, 20deg); \/* -10deg *\/\r\nrotate: rem(-55deg, -15deg); \/* -10deg *\/\r\n\r\n\/* \u8ba1\u7b97*\/\r\nscale: rem(10 * 2, 1.7); \/* 1.3 *\/\r\nrotate: rem(10turn, 18turn \/ 3); \/* 4turn *\/\r\ntransition-duration: rem(20s \/ 2, 3000ms * 2); \/* 4s *\/<\/pre>\n<h4>rem\u548cmod\u7684\u533a\u522b<\/h4>\n<p>mod \u51fd\u6570\u751f\u6210\u4e00\u4e2a\u4e3a\u96f6\u6216\u4e0e\u9664\u6570\u5177\u6709\u76f8\u540c\u7b26\u53f7\u7684\u7ed3\u679c\u3002<br \/>\nrem \u51fd\u6570\u751f\u6210\u4e00\u4e2a\u4e3a\u96f6\u6216\u4e0e\u88ab\u9664\u6570\u5177\u6709\u76f8\u540c\u7b26\u53f7\u7684\u7ed3\u679c\u3002 <\/p>\n<p>\u8fd9\u4e24\u4e2a\u6570\u5b66\u51fd\u6570\u65e5\u5e38\u5f00\u53d1\u9c9c\u6709\u673a\u4f1a\u51fa\u573a\u3002<\/p>\n<p>\u4f46\u662f\u6709\u4e2a\u6570\u5b66\u51fd\u6570\u662f\u4f8b\u5916\uff0c\u90a3\u5c31\u662f<code>round()<\/code>\u51fd\u6570\uff0c\u8fd9\u4e2a\u51fd\u6570\u7684\u8bed\u6cd5\u66f4\u52a0\u590d\u6742\uff0c\u4f46\u540c\u65f6\u4e5f\u66f4\u52a0\u5b9e\u7528\u3002<\/p>\n<h3>\u4e8c\u3001\u5b9e\u7528\u5fc5\u5b66round()\u51fd\u6570<\/h3>\n<p>\u5f88\u591a\u4eba\u4ee5\u4e3a<code>round()<\/code>\u51fd\u6570\u5c31\u662f\u7b80\u5355\u7684\u56db\u820d\u4e94\u5165\uff0c\u5176\u5b9e\u8fd9\u4e2a\u51fd\u6570\u8bbe\u8ba1\u5f97\u975e\u5e38\u5de7\u5999\uff0c\u901a\u8fc7\u4e0d\u540c\u7684\u53c2\u6570\u8bbe\u7f6e\uff0c\u53ef\u4ee5\u5b9e\u73b0\u591a\u79cd\u53d6\u503c\u65b9\u6cd5\uff0c\u4f8b\u5982\uff08\u4ee5JS API\u793a\u610f\uff09\uff1a<\/p>\n<ul>\n<li>Math.ceil()<\/li>\n<li>Math.floor()<\/li>\n<li>Math.round()<\/li>\n<li>Math.trunc()<\/li>\n<\/ul>\n<p>\u90fd\u600e\u4e48\u5b9e\u73b0\u7684\u5462\uff1f\u770b\u6848\u4f8b\u3002<\/p>\n<h4>\u6a21\u62dfMath.ceil()\u53d6\u503c<\/h4>\n<p><code>Math.ceil()<\/code>\u662f\u5411\u4e0a\u53d6\u6574\uff0c\u4f7f\u7528CSS\u8bed\u6cd5\u8868\u793a\u5219\u662f\uff1a<\/p>\n<pre>canvas {\r\n  border: round(up, 1.01px, 1px) solid;\r\n}<\/pre>\n<p>\u7ed3\u679c\u6e32\u67d3\u7684\u8fb9\u6846\u5bbd\u5ea6\u5219\u662f2px\uff0c\u5b9e\u65f6\u6e32\u67d3\u6548\u679c\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><canvas style=\"border: round(up, 1.01px, 1px) solid\"><\/canvas><\/p>\n<p>\u5176\u4e2d\uff0cup\u8868\u793a\u5411\u4e0a\u53d6\u6574\uff0c\u7b2c\u4e09\u4e2a\u53c2\u6570\u8868\u793a\u6700\u7ec8\u8ba1\u7b97\u503c\u9700\u8981\u53ef\u4ee5\u88ab\u6b64\u6570\u503c\u6574\u9664\uff0c\u4f8b\u5982round(up, 2.01px, 2px)\u7684\u8ba1\u7b97\u503c\u5c31\u662f<code>4px<\/code>\u3002<\/p>\n<pre>canvas {\r\n  border: round(up, 2.01px, 2px) solid;\r\n}<\/pre>\n<p>\u5b9e\u65f6\u6e32\u67d3\u6548\u679c\u5982\u4e0b\u6240\u793a\uff1a<br \/>\n<canvas style=\"border: round(up, 2.01px, 2px) solid\"><\/canvas><\/p>\n<h4>\u6a21\u62dfMath.floor()\u53d6\u503c<\/h4>\n<p><code>Math.floor()<\/code>\u662f\u5411\u4e0b\u53d6\u6574\uff0c\u56e0\u6b64\uff0c\u4e0b\u9762CSS\u4ee3\u7801\u7684\u8fb9\u6846\u5927\u5c0f\u5c31\u662f1px\u3002<\/p>\n<pre>canvas {\r\n  border: round(down, 1.99px, 1px) solid;\r\n}<\/pre>\n<p><canvas style=\"border: round(down, 1.99px, 1px) solid\"><\/canvas><\/p>\n<h4>\u6a21\u62dfMath.round()\u53d6\u503c<\/h4>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>round( nearest, &lt;valueToRound&gt; , &lt;roundingInterval&gt; )<\/pre>\n<p>\u6216\u8005\u76f4\u63a5\uff1a<\/p>\n<pre>round( &lt;valueToRound&gt; , &lt;roundingInterval&gt; )<\/pre>\n<p>\u5c31\u662f\u6211\u4eec\u5e38\u8bf4\u7684\u56db\u820d\u4e94\u5165\u3002<\/p>\n<h4>\u6a21\u62dfMath.trunc()\u53d6\u503c<\/h4>\n<p>\u8bed\u6cd5\uff1a<\/p>\n<pre>round( to-zero, &lt;valueToRound&gt; , &lt;roundingInterval&gt; )<\/pre>\n<p>\u8868\u793a\u5c06<code>valueToRound<\/code>\u820d\u5165\u4e3a<code>roundingInterval<\/code>\u63a5\u8fd1\/\u63a5\u8fd1\u96f6\u7684\u6700\u63a5\u8fd1\u6574\u6570\u500d\u3002<\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>canvas {\r\n  border: round(to-zero, 5.5px, 2px) solid;\r\n}<\/pre>\n<p>\u8fb9\u6846\u5bbd\u5ea6\u662f4px\uff0c\u56e0\u4e3a5.5px\u5f800\u8d70\uff0c\u6700\u9760\u8fd12px\u500d\u6570\u7684\u503c\u5c31\u662f4px\u3002<\/p>\n<p>\u6548\u679c\u793a\u610f\uff1a<\/p>\n<p><canvas style=\"border: round(to-zero, 5.5px, 2px) solid\"><\/canvas><\/p>\n<p>\u800cround(to-zero, 5.5px, 3px)\u7684\u8ba1\u7b97\u503c\u5c31\u662f3px\uff0c\u6bd45.5px\u5c0f\u7684\u53c8\u662f3px\u5907\u6ce8\u7684\u6700\u5927\u503c\u5c31\u662f3px\u3002<\/p>\n<p>\u6548\u679c\u793a\u610f\uff1a<\/p>\n<p><canvas style=\"border: round(to-zero, 5.5px, 3px) solid\"><\/canvas><\/p>\n<h3>\u4e8c\u3001round()\u51fd\u6570\u7684\u5b9e\u9645\u5e94\u7528<\/h3>\n<p>\u4e3e\u4e24\u4e2a\u5b9e\u7528\u6848\u4f8b\u5427\u3002<\/p>\n<h4>1. \u8ba9\u54cd\u5e94\u5f0ffont-size\u6c38\u8fdc\u662f\u6574\u6570<\/h4>\n<p>\u79fb\u52a8\u7aef\u5f00\u53d1\u4f1a\u4f7f\u7528rem\u5355\u4f4d\u548c\u5c4f\u5e55\u5c3a\u5bf8\u5173\u8054\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>html {\r\n  font-size: clamp(16px, calc(100% + 4 * (100vw - 375px) \/ 105), 20px);\r\n}<\/pre>\n<p>\u6b64\u65f6\uff0c1rem\u5bf9\u5e94\u7684\u5c3a\u5bf8\u5c31\u6709\u53ef\u80fd\u662f\u5c0f\u6570\u3002<\/p>\n<p>\u5c0f\u6570\u5c31\u4f1a\u6709\u4ec0\u4e48\u95ee\u9898\uff0c\u4f8b\u5982\u4e00\u4e9bSVG\u56fe\u6807\u5c3a\u5bf8\u4f7f\u7528rem\u8868\u793a\uff0c\u7531\u4e8e\u51fa\u73b0\u4e86\u5c0f\u6570\uff0c\u56fe\u6807\u8fb9\u7f18\u5c31\u5f88\u53ef\u80fd\u51fa\u73b0\u7f1d\u9699\u3002<\/p>\n<p>\u53c8\u6216\u8005\u662f\u5706\u89d2\u8fb9\u7f18\uff0c\u6216\u8005box-shadow\u8fb9\u7f18\u51fa\u73b0\u5f88\u5fae\u5c0f\u7684\u7f1d\u9699\u98ce\u3002<\/p>\n<p>\u6b64\u65f6\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528round()\u51fd\u6570\u8ba9\u5c3a\u5bf8\u53d6\u6574\uff0c\u4ee5\u89c4\u907f\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n<p>\u4f7f\u7528\u793a\u610f\uff1a<\/p>\n<pre>&lt;ul&gt;\r\n  &lt;li&gt;HTML\u5e76\u4e0d\u7b80\u5355&lt;\/li&gt;\r\n  &lt;li&gt;CSS\u65b0\u4e16\u754c&lt;\/li&gt;\r\n  &lt;li&gt;\u597d\u4e66\u63a8\u8350&lt;\/li&gt;\r\n&lt;\/ul&gt;<\/pre>\n<pre>ul {\r\n  font-size: round(1rem, 1px);\r\n}<\/pre>\n<p>\u6b64\u65f6\uff0c<code>&lt;ul&gt;<\/code>\u5217\u8868\u7684\u5b57\u53f7\u5927\u5c0f\u4e00\u5b9a\u662f\u6574\u6570\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709round\u56db\u820d\u4e94\u5165\uff0c\u5219\u5b57\u53f7\u5927\u5c0f\u5219\u5c31\u53ef\u80fd\u662f\u5c0f\u6570\u3002<\/p>\n<p>\u53c2\u89c1\u4e0b\u56feGIF\u52a8\u6001\u793a\u610f\uff08\u4e0d\u5e94\u7528round\u662f\u5c0f\u657018.2476px\uff0c\u5e94\u7528round()\u51fd\u6570\u5219\u662f\u6574\u657018px\uff09\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/round-font-size-s.gif\" width=\"427\" height=\"243\" alt=\"\u5b57\u53f7round\u53d6\u6574\u793a\u610f\" class=\"alignnone size-medium\" \/><\/p>\n<h4>2. \u6a21\u62dfanimation\u7684steps()\u6b65\u9636\u51fd\u6570\u6548\u679c<\/h4>\n<p>round()\u51fd\u6570\u7684\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u8868\u793a\u53d6\u820d\u7684\u6700\u5c0f\u6570\u503c\u5355\u5143\uff0c\u8bd5\u60f3\u4e0b\uff0c\u5982\u679c\u662f\u4e00\u4e2a0-100\u7684\u52a8\u753b\uff0c\u5982\u679c\u6211\u4eec\u8bbe\u7f6e\u53d6\u6574\u7684\u5355\u5143\u662f20\uff0c\u90a3\u5c82\u4e0d\u662f\u5e94\u7528round()\u51fd\u6570\u540e\uff0c\u6700\u7ec8\u7684\u8ba1\u7b97\u503c\u53ea\u53ef\u80fd\u662f0\u300120\u300140\u300160\u300180\u548c100\uff0c\u4e0d\u5c31\u548cCSS\u52a8\u753b\u4e2d\u7684steps()\u6b65\u9636\u51fd\u6570\u5f88\u50cf\u4e86\u4e48\uff1f<\/p>\n<p>\u4f8b\u5982\u6709\u4e2a\u9759\u6001\u7684loading\u56fe\u6807\uff1a<\/p>\n<pre>&lt;img src=\"loading.png\" class=\"spin\" \/&gt;<\/pre>\n<p>\u5b9e\u9645\u6e32\u67d3\u6548\u679c\u5982\u4e0b\uff0c\u662f\u4e2a\u9759\u6001\u7684\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/image.zhangxinxu.com\/image\/blog\/201806\/loading-dot.png\" width=\"30\" height=\"30\"><\/p>\n<p>\u5219\u4e0b\u9762\u8fd9\u6bb5CSS\u4ee3\u7801\u5c31\u53ef\u4ee5\u8ba9\u6b64\u56fe\u6807loading\u65cb\u8f6c\u6548\u679c\uff1a<\/p>\n<pre>.spin {\r\n  transform: rotate(round(calc(var(--seed) * 3.6deg), 45deg));\r\n  animation: seed 1s linear infinite;    \r\n}\r\n@property --seed {\r\n  syntax: \"&lt;integer&gt;\";\r\n  inherits: false;\r\n  initial-value: 0;\r\n}\r\n@keyframes seed {\r\n  from { --seed: 0; }    \r\n  to { --seed: 100; }    \r\n}<\/pre>\n<p>\u773c\u89c1\u4e3a\u5b9e\uff0c\u60a8\u53ef\u4ee5\u72e0\u72e0\u5730\u70b9\u51fb\u8fd9\u91cc\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/study\/202409\/css-round-steps-animation-demo.php\" rel=\"noopener\" target=\"_blank\">\u4f7f\u7528CSS round()\u51fd\u6570\u6a21\u62dfsteps\u52a8\u753bdemo<\/a><\/p>\n<p>\u6548\u679c\u622a\u56fe\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/2024-09-25_233425.png\" width=\"499\" height=\"277\" alt=\"demo\u52a8\u753bloading\u6548\u679c\u622a\u56fe\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u662f\u4e0d\u662f\u5b9e\u73b0\u5f97\u975e\u5e38\u5de7\u5999\uff01<\/p>\n<p>\u867d\u7136<code>steps()<\/code>\u51fd\u6570\u53ef\u4ee5\u5b9e\u73b0\u4e00\u6837\u7684\u6548\u679c\uff0c\u4f46\u662f<code>steps()<\/code>\u7684\u5b66\u4e60\u548c\u7406\u89e3\u6210\u672c\u8981\u6bd4<code>round()<\/code>\u51fd\u6570\u9ad8\u591a\u4e86\uff0c\u552f\u4e00\u7684\u4f18\u52bf\u5c31\u662f\u517c\u5bb9\u6027\u4e86\u3002<\/p>\n<p>\u4e0d\u8fc7\u8fd9\u4e2a\u4f8b\u5b50\u4e5f\u53ef\u4ee5\u770b\u51fa<code>round()<\/code>\u51fd\u6570\u7684\u5e94\u7528\u6f5c\u529b\u3002<\/p>\n<h3>\u56db\u3001\u7ed3\u8bed\u5df4\u62c9\u5df4\u62c9<\/h3>\n<p>\u76ee\u524d\uff0c\u89c4\u8303\u91cc\u9762\u63d0\u53ca\u7684\u6570\u5b66\u51fd\u6570\u5927\u90e8\u5206\u90fd\u5df2\u7ecf\u652f\u6301\u4e86\u5427\u3002<\/p>\n<p>\u9996\u5148\u7b2c\u4e00\u6279\u652f\u6301\u7684\u662fmin()\/max()\/clamp()\u8fd9\u4e9b\u6570\u5b66\u51fd\u6570\uff0c\u8be6\u89c1\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2020\/04\/css-min-max-clamp\/\">\u4e86\u89e3CSS min()\/max()\/clamp()\u6570\u5b66\u51fd\u6570<\/a>\u201d\u4e00\u6587\u3002<\/p>\n<p>\u518d\u7136\u540e\u5c31\u662f\uff0c<code>sin()<\/code>\/<code>cos()<\/code>\u8fd9\u4e9b\u51fd\u6570\u652f\u6301\uff0c\u53bb\u5e74\u5f00\u59cb\u652f\u6301\u7684\uff0c\u4e4b\u524d\u4e5f\u4ecb\u7ecd\u8fc7\uff0c\u53c2\u89c1\u201c<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/2023\/06\/css-sin-cos-tan-function\/\">CSS sin()\/cos()\u7b49\u6570\u5b66\u4e09\u89d2\u51fd\u6570\u7b80\u4ecb\u4e0e\u5e94\u7528<\/a>\u201d\u4e00\u6587\u3002<\/p>\n<p>\u5176\u4ed6\u6570\u5b66\u51fd\u6570\uff0c\u5982\u6c42\u5e73\u65b9\u6839\u7684sqrt()\u51fd\u6570\uff0c\u5e42\u6307\u6570\u7684pow()\u51fd\u6570\uff0c\u8fd4\u56de\u7ed9\u5b9a\u6570\u5b57\u7684\u5e42\u7684\u6570\u5b66\u5e38\u6570e\u7684\u7279\u6b8a\u6307\u6570\u51fd\u6570exp()\uff0c\u8fd4\u56de\u6570\u5b57\u5bf9\u6570\u7684log()\u51fd\u6570\uff0c\u5219\u662f\u53bb\u5e74\u5e95\u652f\u6301\u7684\uff0c\u7b97\u662f\u7b2c3\u6ce2\u5427\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/2024-09-25_234220.png\" width=\"627\" height=\"220\" alt=\"sqrt\u51fd\u6570\u517c\u5bb9\u6027\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u7136\u540e\u5c31\u662f\u672c\u6587\u8fd9\u51e0\u4e2a\u6570\u503c\u53d6\u820d\u51fd\u6570\uff0c\u5c5e\u4e8e\u7b2c4\u6279\u6b21\u3002<\/p>\n<p>\u6700\u540e\u4e00\u6ce2\u5e94\u8be5\u5c31\u662f\u7edd\u5bf9\u503cabs()\u51fd\u6570\uff0c\u6b63\u8d1f\u96f6\u5224\u65ad\u7684sign()\u7684\u51fd\u6570\u3002<\/p>\n<p>\u603b\u4e4b\u5f88\u5947\u602a\uff0c\u4e0d\u77e5\u9053\u4e3a\u4f55Chrome\u6d4f\u89c8\u5668\u4e0d\u4e00\u6b21\u6027\u652f\u6301\uff0c\u800c\u662f\u52065\u6ce2\u8fdb\u884c\u3002<\/p>\n<p>\u597d\u5427\uff0c\u5c31\u8bf4\u8fd9\u4e48\u591a\u5427\u3002<\/p>\n<p>\u611f\u8c22\u9605\u8bfb\uff0c\u6b22\u8fce<button onclick=\"shareWeixin.click()\" class=\"entry-share-btn\">\u5206\u4eab<\/button>\uff01<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/lingyuling.png\" width=\"120\" height=\"100\" alt=\"\u51cc\u7389\u7075\" class=\"alignnone size-medium\" \/><\/p>\n<p>\u672c\u6587\u4e3a\u539f\u521b\u6587\u7ae0\uff0c\u6b22\u8fce\u5206\u4eab\uff0c\u52ff\u5168\u6587\u8f6c\u8f7d\uff0c\u5982\u679c\u5b9e\u5728\u559c\u6b22\uff0c\u53ef\u6536\u85cf\uff0c\u6c38\u4e0d\u8fc7\u671f\uff0c\u4e14\u4f1a\u53ca\u65f6\u66f4\u65b0\u77e5\u8bc6\u70b9\u53ca\u4fee\u6b63\u9519\u8bef\uff0c\u9605\u8bfb\u4f53\u9a8c\u4e5f\u66f4\u597d\u3002<br \/>\n\u672c\u6587\u5730\u5740\uff1a<a href=\"https:\/\/www.zhangxinxu.com\/wordpress\/?p=11363\">https:\/\/www.zhangxinxu.com\/wordpress\/?p=11363<\/a><\/p>\n<p>\uff08\u672c\u7bc7\u5b8c\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/image.zhangxinxu.com\/image\/blog\/202409\/curve-cover.jpg\" width=\"160\" height=\"103\" alt=\"\u5c01\u9762\u5360\u4f4d\u56fe\" class=\"alignright size-medium\" loading=\"lazy\" \/><\/p>\n<p>\u6700\u8fd1Chrome\u8fdb\u884c\u4e86\u7b2c4\u6279CSS\u6570\u5b66\u51fd\u6570\u7684\u652f\u6301\uff0c\u5305\u62ecmod()\/rem()\/round()\uff0c\u5176\u4e2dround()\u51fd\u6570\u5c24\u4e3a\u7684\u5b9e\u7528\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[2006,531,1927,1595,63,2004,780,1076,1818,2005,1928,1267],"_links":{"self":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11363"}],"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=11363"}],"version-history":[{"count":1,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11363\/revisions"}],"predecessor-version":[{"id":12072,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/posts\/11363\/revisions\/12072"}],"wp:attachment":[{"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/media?parent=11363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/categories?post=11363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhangxinxu.com\/wordpress\/wp-json\/wp\/v2\/tags?post=11363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}