[{"data":1,"prerenderedAt":2409},["ShallowReactive",2],{"page-\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmorphing-shapes-with-clip-path-polygon\u002F":3,"content-all-pages":1844,"live-demo:polygon-play-pause":2403},{"id":4,"title":5,"body":6,"description":1825,"extension":1826,"meta":1827,"navigation":408,"path":1840,"seo":1841,"stem":1842,"__hash__":1843},"content\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmorphing-shapes-with-clip-path-polygon\u002Findex.md","Morphing Shapes With clip-path: polygon(): Point-Matched Transitions",{"type":7,"value":8,"toc":1815},"minimark",[9,19,37,42,64,71,74,78,188,199,213,216,220,223,227,1242,1249,1264,1268,1271,1329,1332,1358,1361,1365,1368,1686,1704,1708,1718,1722,1731,1737,1767,1779,1783,1812],[10,11,13,14,18],"h1",{"id":12},"morphing-shapes-with-clip-path-polygon-point-matched-transitions","Morphing Shapes With ",[15,16,17],"code",{},"clip-path: polygon()",": Point-Matched Transitions",[20,21,22,23,25,26,31,32,36],"p",{},"Shape morphs are a staple of expressive interfaces: a play triangle folding into a pause pair, a hamburger becoming a cross, a square badge blooming into a star when an achievement unlocks. SVG path animation can do this but pulls icons out of CSS and usually into a script. ",[15,24,17],{}," can do most of it in plain CSS, with one strict rule — both shapes must have the same number of points — and one subtle one — the points must correspond sensibly. This page shows how to satisfy both and build morphs that stay clean at every in-between frame. It sits in ",[27,28,30],"a",{"href":29},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002F","Clip-Path & Mask Animations"," within the ",[27,33,35],{"href":34},"\u002Fcss-only-micro-interactions-animations\u002F","CSS-Only Micro-Interactions & Animations"," guide.",[38,39,41],"h2",{"id":40},"why-morph-with-clip-path","Why morph with clip-path",[20,43,44,45,48,49,52,53,52,56,59,60,63],{},"Clipping an element to a polygon turns any box — a coloured ",[15,46,47],{},"\u003Cspan>",", an image, a gradient — into that shape, and the browser interpolates between two polygons vertex by vertex. That makes shape changes a property transition like any other: triggered by ",[15,50,51],{},":hover",", ",[15,54,55],{},":checked",[15,57,58],{},":focus-visible"," or a class, timed with ",[15,61,62],{},"transition",", eased with any timing function, and cancellable mid-flight.",[20,65,66,67,70],{},"The alternatives each have costs. Swapping two icons with opacity produces a cross-fade, not a morph. Animating an SVG path's ",[15,68,69],{},"d"," attribute works in some engines and requires identical command structures, which is harder to author than a point list. Transforming multiple bars, the classic hamburger technique, needs several elements and careful transform origins. For solid, flat, straight-edged shapes, a clipped polygon is usually the least code.",[20,72,73],{},"Morphs carry meaning, so the accessibility rule is to never let the shape be the only carrier of state. A morphing play button must also change its accessible name.",[38,75,77],{"id":76},"the-two-rules-of-polygon-interpolation","The two rules of polygon interpolation",[79,80,86,87,86,91,86,95,86,103,86,111,86,117,86,121,86,124,86,129,86,136,86,142,86,147,86,155,86,159,86,162,86,166,86,170,86,174,86,178,86,182,86,184],"svg",{"viewBox":81,"role":82,"ariaLabel":83,"xmlns":84,"style":85},"0 0 720 330","img","A triangle padded to six points morphing into a hexagon, with matching point numbers on both shapes","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;height:auto;max-width:720px;margin:2rem 0","\n  ",[88,89,90],"title",{},"Equal counts, matching order",[92,93,94],"desc",{},"Left, a triangle whose three corners each carry two coincident points, six in total, numbered clockwise from the top. Right, a hexagon with six points numbered clockwise from the top. Each numbered point travels to the same-numbered point.",[96,97,102],"text",{"textAnchor":98,"x":99,"y":100,"style":101},"middle","360","26","text-anchor:middle;fill:currentColor;font:700 17px sans-serif","Pad the simpler shape; number both the same way",[104,105],"polygon",{"points":106,"fill":107,"opacity":108,"stroke":109,"strokeWidth":110},"180,60 290,250 70,250","#7aa2ff","0.3","currentColor","1.5",[112,113],"circle",{"cx":114,"cy":115,"r":116,"fill":109},"180","60","6",[112,118],{"cx":119,"cy":120,"r":116,"fill":109},"290","250",[112,122],{"cx":123,"cy":120,"r":116,"fill":109},"70",[96,125,128],{"textAnchor":98,"x":114,"y":126,"style":127},"50","text-anchor:middle;fill:currentColor;font:12px ui-monospace,monospace","1,2",[96,130,135],{"textAnchor":131,"x":132,"y":133,"style":134},"start","304","266","text-anchor:start;fill:currentColor;font:12px ui-monospace,monospace","3,4",[96,137,141],{"textAnchor":138,"x":139,"y":133,"style":140},"end","56","text-anchor:end;fill:currentColor;font:12px ui-monospace,monospace","5,6",[96,143,146],{"textAnchor":98,"x":114,"y":144,"style":145},"300","text-anchor:middle;fill:currentColor;font:12px sans-serif","triangle: 6 points, 3 pairs",[148,149],"line",{"x1":150,"y1":151,"x2":152,"y2":151,"stroke":109,"strokeWidth":153,"opacity":154},"330","155","390","2","0.6",[156,157],"path",{"d":158,"fill":109,"opacity":154},"M382 147 L396 155 L382 163 Z",[104,160],{"points":161,"fill":107,"opacity":108,"stroke":109,"strokeWidth":110},"540,60 630,110 630,210 540,260 450,210 450,110",[96,163,165],{"textAnchor":98,"x":164,"y":126,"style":127},"540","1",[96,167,153],{"textAnchor":131,"x":168,"y":169,"style":134},"642","114",[96,171,173],{"textAnchor":131,"x":168,"y":172,"style":134},"214","3",[96,175,177],{"textAnchor":98,"x":164,"y":176,"style":127},"280","4",[96,179,181],{"textAnchor":138,"x":180,"y":172,"style":140},"438","5",[96,183,116],{"textAnchor":138,"x":180,"y":169,"style":140},[96,185,187],{"textAnchor":98,"x":164,"y":186,"style":145},"310","hexagon: 6 points, clockwise",[20,189,190,194,195,198],{},[191,192,193],"strong",{},"Rule one: equal counts."," ",[15,196,197],{},"polygon()"," interpolates only between polygons with the same number of vertices. A triangle has three; a hexagon has six. To morph between them, the triangle must be written with six points. Duplicate points placed on top of each other are perfectly valid — they draw a zero-length edge — and during the morph they separate and travel to their own destinations.",[20,200,201,204,205,209,210,212],{},[191,202,203],{},"Rule two: corresponding order."," Point ",[206,207,208],"em",{},"n"," travels in a straight line to point ",[206,211,208],{},". If both lists start at the top and go clockwise, every point has a short, sensible path. If one starts at the top and the other at the left, points cross paths mid-animation and the shape twists into a bow tie before resolving. Always pick a common start position and direction.",[20,214,215],{},"Where to place the padding points matters too. The triangle above doubles each corner, so as the morph runs each corner splits into two hexagon vertices. Padding all three extras at a single corner would instead make that corner explode outward while the others barely move — occasionally a desired effect, usually not.",[38,217,219],{"id":218},"the-complete-implementation","The complete implementation",[20,221,222],{},"The toggle below morphs a play triangle into a pause symbol and back. The pause symbol is two bars, which as a single polygon is a shape with a notch cut into it — eight points drawn as one outline. The triangle is padded to eight points to match.",[224,225],"live-demo",{"name":226},"polygon-play-pause",[228,229,234],"pre",{"className":230,"code":231,"language":232,"meta":233,"style":233},"language-html shiki shiki-themes github-light-high-contrast github-dark-high-contrast","\u003C!doctype html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n\u003Cmeta charset=\"utf-8\">\n\u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n\u003Ctitle>Play to pause morph\u003C\u002Ftitle>\n\u003Cstyle>\n  body { font: 16px\u002F1.5 system-ui, sans-serif; margin: 2rem; }\n\n  .player { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; }\n\n  \u002F* The checkbox is the state. It stays in the accessibility tree, just\n     visually hidden, so it is focusable and announced. *\u002F\n  .player input {\n    position: absolute;\n    width: 1px;\n    height: 1px;\n    opacity: 0;\n  }\n\n  .player__icon {\n    width: 3rem;\n    height: 3rem;\n    background: #4f46e5;\n    \u002F* PLAY: a right-pointing triangle written with 8 points, in the same\n       order as the pause outline below. Points 3-4 and 2-5 coincide, so\n       the outline runs down a zero-width slit at x=50% and back up. *\u002F\n    clip-path: polygon(\n      20% 10%, 50% 27.5%, 50% 72.5%, 50% 72.5%,\n      50% 27.5%, 85% 50%, 85% 50%, 20% 90%\n    );\n    transition: clip-path 0.3s cubic-bezier(0.65, 0, 0.35, 1);\n  }\n\n  \u002F* PAUSE: two bars as ONE outline: down the left bar, along the bottom\n     to the right bar, up and round it, then back along the bottom edge.\n     The two bottom runs overlap with zero width, so the gap stays empty. *\u002F\n  .player input:checked + .player__icon {\n    clip-path: polygon(\n      20% 10%, 42% 10%, 42% 90%, 58% 90%,\n      58% 10%, 80% 10%, 80% 90%, 20% 90%\n    );\n  }\n\n  .player input:focus-visible + .player__icon {\n    outline: 2px solid #1e1b4b;\n    outline-offset: 4px;\n  }\n\n  \u002F* The visible label changes with the state, so the name is never\n     conveyed by shape alone. *\u002F\n  .player__label::before { content: \"Play\"; }\n  .player input:checked ~ .player__label::before { content: \"Pause\"; }\n\n  @media (prefers-reduced-motion: reduce) {\n    .player__icon { transition: none; }\n  }\n\u003C\u002Fstyle>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Clabel class=\"player\">\n    \u003Cinput type=\"checkbox\" aria-label=\"Playing\">\n    \u003Cspan class=\"player__icon\" aria-hidden=\"true\">\u003C\u002Fspan>\n    \u003Cspan class=\"player__label\" aria-hidden=\"true\">\u003C\u002Fspan>\n  \u003C\u002Flabel>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n","html","",[15,235,236,255,275,285,303,328,342,352,403,410,460,465,472,478,489,503,517,531,544,550,555,563,576,589,602,608,614,620,633,682,729,735,774,779,784,790,796,802,819,830,875,918,923,928,933,948,968,982,987,992,998,1004,1022,1048,1053,1062,1079,1084,1094,1103,1113,1132,1159,1188,1214,1224,1233],{"__ignoreMap":233},[237,238,240,244,248,252],"span",{"class":148,"line":239},1,[237,241,243],{"class":242},"suds8","\u003C!",[237,245,247],{"class":246},"sne4z","doctype",[237,249,251],{"class":250},"s-5SL"," html",[237,253,254],{"class":242},">\n",[237,256,258,261,263,266,269,273],{"class":148,"line":257},2,[237,259,260],{"class":242},"\u003C",[237,262,232],{"class":246},[237,264,265],{"class":250}," lang",[237,267,268],{"class":242},"=",[237,270,272],{"class":271},"sT6z2","\"en\"",[237,274,254],{"class":242},[237,276,278,280,283],{"class":148,"line":277},3,[237,279,260],{"class":242},[237,281,282],{"class":246},"head",[237,284,254],{"class":242},[237,286,288,290,293,296,298,301],{"class":148,"line":287},4,[237,289,260],{"class":242},[237,291,292],{"class":246},"meta",[237,294,295],{"class":250}," charset",[237,297,268],{"class":242},[237,299,300],{"class":271},"\"utf-8\"",[237,302,254],{"class":242},[237,304,306,308,310,313,315,318,321,323,326],{"class":148,"line":305},5,[237,307,260],{"class":242},[237,309,292],{"class":246},[237,311,312],{"class":250}," name",[237,314,268],{"class":242},[237,316,317],{"class":271},"\"viewport\"",[237,319,320],{"class":250}," content",[237,322,268],{"class":242},[237,324,325],{"class":271},"\"width=device-width, initial-scale=1\"",[237,327,254],{"class":242},[237,329,331,333,335,338,340],{"class":148,"line":330},6,[237,332,260],{"class":242},[237,334,88],{"class":246},[237,336,337],{"class":242},">Play to pause morph\u003C\u002F",[237,339,88],{"class":246},[237,341,254],{"class":242},[237,343,345,347,350],{"class":148,"line":344},7,[237,346,260],{"class":242},[237,348,349],{"class":246},"style",[237,351,254],{"class":242},[237,353,355,358,361,364,367,370,374,377,379,382,384,387,390,393,395,397,400],{"class":148,"line":354},8,[237,356,357],{"class":246},"  body",[237,359,360],{"class":242}," { ",[237,362,363],{"class":250},"font",[237,365,366],{"class":242},": ",[237,368,369],{"class":250},"16",[237,371,373],{"class":372},"sHUrx","px",[237,375,376],{"class":242},"\u002F",[237,378,110],{"class":250},[237,380,381],{"class":250}," system-ui",[237,383,52],{"class":242},[237,385,386],{"class":250},"sans-serif",[237,388,389],{"class":242},"; ",[237,391,392],{"class":250},"margin",[237,394,366],{"class":242},[237,396,153],{"class":250},[237,398,399],{"class":372},"rem",[237,401,402],{"class":242},"; }\n",[237,404,406],{"class":148,"line":405},9,[237,407,409],{"emptyLinePlaceholder":408},true,"\n",[237,411,413,416,418,421,423,426,428,431,433,436,438,441,443,446,448,450,453,455,458],{"class":148,"line":412},10,[237,414,415],{"class":250},"  .player",[237,417,360],{"class":242},[237,419,420],{"class":250},"display",[237,422,366],{"class":242},[237,424,425],{"class":250},"inline-flex",[237,427,389],{"class":242},[237,429,430],{"class":250},"align-items",[237,432,366],{"class":242},[237,434,435],{"class":250},"center",[237,437,389],{"class":242},[237,439,440],{"class":250},"gap",[237,442,366],{"class":242},[237,444,445],{"class":250},"0.75",[237,447,399],{"class":372},[237,449,389],{"class":242},[237,451,452],{"class":250},"cursor",[237,454,366],{"class":242},[237,456,457],{"class":250},"pointer",[237,459,402],{"class":242},[237,461,463],{"class":148,"line":462},11,[237,464,409],{"emptyLinePlaceholder":408},[237,466,468],{"class":148,"line":467},12,[237,469,471],{"class":470},"sLBg1","  \u002F* The checkbox is the state. It stays in the accessibility tree, just\n",[237,473,475],{"class":148,"line":474},13,[237,476,477],{"class":470},"     visually hidden, so it is focusable and announced. *\u002F\n",[237,479,481,483,486],{"class":148,"line":480},14,[237,482,415],{"class":250},[237,484,485],{"class":246}," input",[237,487,488],{"class":242}," {\n",[237,490,492,495,497,500],{"class":148,"line":491},15,[237,493,494],{"class":250},"    position",[237,496,366],{"class":242},[237,498,499],{"class":250},"absolute",[237,501,502],{"class":242},";\n",[237,504,506,509,511,513,515],{"class":148,"line":505},16,[237,507,508],{"class":250},"    width",[237,510,366],{"class":242},[237,512,165],{"class":250},[237,514,373],{"class":372},[237,516,502],{"class":242},[237,518,520,523,525,527,529],{"class":148,"line":519},17,[237,521,522],{"class":250},"    height",[237,524,366],{"class":242},[237,526,165],{"class":250},[237,528,373],{"class":372},[237,530,502],{"class":242},[237,532,534,537,539,542],{"class":148,"line":533},18,[237,535,536],{"class":250},"    opacity",[237,538,366],{"class":242},[237,540,541],{"class":250},"0",[237,543,502],{"class":242},[237,545,547],{"class":148,"line":546},19,[237,548,549],{"class":242},"  }\n",[237,551,553],{"class":148,"line":552},20,[237,554,409],{"emptyLinePlaceholder":408},[237,556,558,561],{"class":148,"line":557},21,[237,559,560],{"class":250},"  .player__icon",[237,562,488],{"class":242},[237,564,566,568,570,572,574],{"class":148,"line":565},22,[237,567,508],{"class":250},[237,569,366],{"class":242},[237,571,173],{"class":250},[237,573,399],{"class":372},[237,575,502],{"class":242},[237,577,579,581,583,585,587],{"class":148,"line":578},23,[237,580,522],{"class":250},[237,582,366],{"class":242},[237,584,173],{"class":250},[237,586,399],{"class":372},[237,588,502],{"class":242},[237,590,592,595,597,600],{"class":148,"line":591},24,[237,593,594],{"class":250},"    background",[237,596,366],{"class":242},[237,598,599],{"class":250},"#4f46e5",[237,601,502],{"class":242},[237,603,605],{"class":148,"line":604},25,[237,606,607],{"class":470},"    \u002F* PLAY: a right-pointing triangle written with 8 points, in the same\n",[237,609,611],{"class":148,"line":610},26,[237,612,613],{"class":470},"       order as the pause outline below. Points 3-4 and 2-5 coincide, so\n",[237,615,617],{"class":148,"line":616},27,[237,618,619],{"class":470},"       the outline runs down a zero-width slit at x=50% and back up. *\u002F\n",[237,621,623,626,628,630],{"class":148,"line":622},28,[237,624,625],{"class":250},"    clip-path",[237,627,366],{"class":242},[237,629,104],{"class":250},[237,631,632],{"class":242},"(\n",[237,634,636,639,642,645,647,649,651,653,656,658,660,662,664,667,669,671,673,675,677,679],{"class":148,"line":635},29,[237,637,638],{"class":250},"      20",[237,640,641],{"class":372},"%",[237,643,644],{"class":250}," 10",[237,646,641],{"class":372},[237,648,52],{"class":242},[237,650,126],{"class":250},[237,652,641],{"class":372},[237,654,655],{"class":250}," 27.5",[237,657,641],{"class":372},[237,659,52],{"class":242},[237,661,126],{"class":250},[237,663,641],{"class":372},[237,665,666],{"class":250}," 72.5",[237,668,641],{"class":372},[237,670,52],{"class":242},[237,672,126],{"class":250},[237,674,641],{"class":372},[237,676,666],{"class":250},[237,678,641],{"class":372},[237,680,681],{"class":242},",\n",[237,683,685,688,690,692,694,696,699,701,704,706,708,710,712,714,716,718,721,723,726],{"class":148,"line":684},30,[237,686,687],{"class":250},"      50",[237,689,641],{"class":372},[237,691,655],{"class":250},[237,693,641],{"class":372},[237,695,52],{"class":242},[237,697,698],{"class":250},"85",[237,700,641],{"class":372},[237,702,703],{"class":250}," 50",[237,705,641],{"class":372},[237,707,52],{"class":242},[237,709,698],{"class":250},[237,711,641],{"class":372},[237,713,703],{"class":250},[237,715,641],{"class":372},[237,717,52],{"class":242},[237,719,720],{"class":250},"20",[237,722,641],{"class":372},[237,724,725],{"class":250}," 90",[237,727,728],{"class":372},"%\n",[237,730,732],{"class":148,"line":731},31,[237,733,734],{"class":242},"    );\n",[237,736,738,741,744,746,749,752,755,758,760,762,764,767,769,771],{"class":148,"line":737},32,[237,739,740],{"class":250},"    transition",[237,742,743],{"class":242},": clip-path ",[237,745,108],{"class":250},[237,747,748],{"class":372},"s",[237,750,751],{"class":250}," cubic-bezier",[237,753,754],{"class":242},"(",[237,756,757],{"class":250},"0.65",[237,759,52],{"class":242},[237,761,541],{"class":250},[237,763,52],{"class":242},[237,765,766],{"class":250},"0.35",[237,768,52],{"class":242},[237,770,165],{"class":250},[237,772,773],{"class":242},");\n",[237,775,777],{"class":148,"line":776},33,[237,778,549],{"class":242},[237,780,782],{"class":148,"line":781},34,[237,783,409],{"emptyLinePlaceholder":408},[237,785,787],{"class":148,"line":786},35,[237,788,789],{"class":470},"  \u002F* PAUSE: two bars as ONE outline: down the left bar, along the bottom\n",[237,791,793],{"class":148,"line":792},36,[237,794,795],{"class":470},"     to the right bar, up and round it, then back along the bottom edge.\n",[237,797,799],{"class":148,"line":798},37,[237,800,801],{"class":470},"     The two bottom runs overlap with zero width, so the gap stays empty. *\u002F\n",[237,803,805,807,809,811,814,817],{"class":148,"line":804},38,[237,806,415],{"class":250},[237,808,485],{"class":246},[237,810,55],{"class":250},[237,812,813],{"class":372}," +",[237,815,816],{"class":250}," .player__icon",[237,818,488],{"class":242},[237,820,822,824,826,828],{"class":148,"line":821},39,[237,823,625],{"class":250},[237,825,366],{"class":242},[237,827,104],{"class":250},[237,829,632],{"class":242},[237,831,833,835,837,839,841,843,846,848,850,852,854,856,858,860,862,864,867,869,871,873],{"class":148,"line":832},40,[237,834,638],{"class":250},[237,836,641],{"class":372},[237,838,644],{"class":250},[237,840,641],{"class":372},[237,842,52],{"class":242},[237,844,845],{"class":250},"42",[237,847,641],{"class":372},[237,849,644],{"class":250},[237,851,641],{"class":372},[237,853,52],{"class":242},[237,855,845],{"class":250},[237,857,641],{"class":372},[237,859,725],{"class":250},[237,861,641],{"class":372},[237,863,52],{"class":242},[237,865,866],{"class":250},"58",[237,868,641],{"class":372},[237,870,725],{"class":250},[237,872,641],{"class":372},[237,874,681],{"class":242},[237,876,878,881,883,885,887,889,892,894,896,898,900,902,904,906,908,910,912,914,916],{"class":148,"line":877},41,[237,879,880],{"class":250},"      58",[237,882,641],{"class":372},[237,884,644],{"class":250},[237,886,641],{"class":372},[237,888,52],{"class":242},[237,890,891],{"class":250},"80",[237,893,641],{"class":372},[237,895,644],{"class":250},[237,897,641],{"class":372},[237,899,52],{"class":242},[237,901,891],{"class":250},[237,903,641],{"class":372},[237,905,725],{"class":250},[237,907,641],{"class":372},[237,909,52],{"class":242},[237,911,720],{"class":250},[237,913,641],{"class":372},[237,915,725],{"class":250},[237,917,728],{"class":372},[237,919,921],{"class":148,"line":920},42,[237,922,734],{"class":242},[237,924,926],{"class":148,"line":925},43,[237,927,549],{"class":242},[237,929,931],{"class":148,"line":930},44,[237,932,409],{"emptyLinePlaceholder":408},[237,934,936,938,940,942,944,946],{"class":148,"line":935},45,[237,937,415],{"class":250},[237,939,485],{"class":246},[237,941,58],{"class":250},[237,943,813],{"class":372},[237,945,816],{"class":250},[237,947,488],{"class":242},[237,949,951,954,956,958,960,963,966],{"class":148,"line":950},46,[237,952,953],{"class":250},"    outline",[237,955,366],{"class":242},[237,957,153],{"class":250},[237,959,373],{"class":372},[237,961,962],{"class":250}," solid",[237,964,965],{"class":250}," #1e1b4b",[237,967,502],{"class":242},[237,969,971,974,976,978,980],{"class":148,"line":970},47,[237,972,973],{"class":250},"    outline-offset",[237,975,366],{"class":242},[237,977,177],{"class":250},[237,979,373],{"class":372},[237,981,502],{"class":242},[237,983,985],{"class":148,"line":984},48,[237,986,549],{"class":242},[237,988,990],{"class":148,"line":989},49,[237,991,409],{"emptyLinePlaceholder":408},[237,993,995],{"class":148,"line":994},50,[237,996,997],{"class":470},"  \u002F* The visible label changes with the state, so the name is never\n",[237,999,1001],{"class":148,"line":1000},51,[237,1002,1003],{"class":470},"     conveyed by shape alone. *\u002F\n",[237,1005,1007,1010,1012,1015,1017,1020],{"class":148,"line":1006},52,[237,1008,1009],{"class":250},"  .player__label::before",[237,1011,360],{"class":242},[237,1013,1014],{"class":250},"content",[237,1016,366],{"class":242},[237,1018,1019],{"class":271},"\"Play\"",[237,1021,402],{"class":242},[237,1023,1025,1027,1029,1031,1034,1037,1039,1041,1043,1046],{"class":148,"line":1024},53,[237,1026,415],{"class":250},[237,1028,485],{"class":246},[237,1030,55],{"class":250},[237,1032,1033],{"class":372}," ~",[237,1035,1036],{"class":250}," .player__label::before",[237,1038,360],{"class":242},[237,1040,1014],{"class":250},[237,1042,366],{"class":242},[237,1044,1045],{"class":271},"\"Pause\"",[237,1047,402],{"class":242},[237,1049,1051],{"class":148,"line":1050},54,[237,1052,409],{"emptyLinePlaceholder":408},[237,1054,1056,1059],{"class":148,"line":1055},55,[237,1057,1058],{"class":372},"  @media",[237,1060,1061],{"class":242}," (prefers-reduced-motion: reduce) {\n",[237,1063,1065,1068,1070,1072,1074,1077],{"class":148,"line":1064},56,[237,1066,1067],{"class":250},"    .player__icon",[237,1069,360],{"class":242},[237,1071,62],{"class":250},[237,1073,366],{"class":242},[237,1075,1076],{"class":250},"none",[237,1078,402],{"class":242},[237,1080,1082],{"class":148,"line":1081},57,[237,1083,549],{"class":242},[237,1085,1087,1090,1092],{"class":148,"line":1086},58,[237,1088,1089],{"class":242},"\u003C\u002F",[237,1091,349],{"class":246},[237,1093,254],{"class":242},[237,1095,1097,1099,1101],{"class":148,"line":1096},59,[237,1098,1089],{"class":242},[237,1100,282],{"class":246},[237,1102,254],{"class":242},[237,1104,1106,1108,1111],{"class":148,"line":1105},60,[237,1107,260],{"class":242},[237,1109,1110],{"class":246},"body",[237,1112,254],{"class":242},[237,1114,1116,1119,1122,1125,1127,1130],{"class":148,"line":1115},61,[237,1117,1118],{"class":242},"  \u003C",[237,1120,1121],{"class":246},"label",[237,1123,1124],{"class":250}," class",[237,1126,268],{"class":242},[237,1128,1129],{"class":271},"\"player\"",[237,1131,254],{"class":242},[237,1133,1135,1138,1141,1144,1146,1149,1152,1154,1157],{"class":148,"line":1134},62,[237,1136,1137],{"class":242},"    \u003C",[237,1139,1140],{"class":246},"input",[237,1142,1143],{"class":250}," type",[237,1145,268],{"class":242},[237,1147,1148],{"class":271},"\"checkbox\"",[237,1150,1151],{"class":250}," aria-label",[237,1153,268],{"class":242},[237,1155,1156],{"class":271},"\"Playing\"",[237,1158,254],{"class":242},[237,1160,1162,1164,1166,1168,1170,1173,1176,1178,1181,1184,1186],{"class":148,"line":1161},63,[237,1163,1137],{"class":242},[237,1165,237],{"class":246},[237,1167,1124],{"class":250},[237,1169,268],{"class":242},[237,1171,1172],{"class":271},"\"player__icon\"",[237,1174,1175],{"class":250}," aria-hidden",[237,1177,268],{"class":242},[237,1179,1180],{"class":271},"\"true\"",[237,1182,1183],{"class":242},">\u003C\u002F",[237,1185,237],{"class":246},[237,1187,254],{"class":242},[237,1189,1191,1193,1195,1197,1199,1202,1204,1206,1208,1210,1212],{"class":148,"line":1190},64,[237,1192,1137],{"class":242},[237,1194,237],{"class":246},[237,1196,1124],{"class":250},[237,1198,268],{"class":242},[237,1200,1201],{"class":271},"\"player__label\"",[237,1203,1175],{"class":250},[237,1205,268],{"class":242},[237,1207,1180],{"class":271},[237,1209,1183],{"class":242},[237,1211,237],{"class":246},[237,1213,254],{"class":242},[237,1215,1217,1220,1222],{"class":148,"line":1216},65,[237,1218,1219],{"class":242},"  \u003C\u002F",[237,1221,1121],{"class":246},[237,1223,254],{"class":242},[237,1225,1227,1229,1231],{"class":148,"line":1226},66,[237,1228,1089],{"class":242},[237,1230,1110],{"class":246},[237,1232,254],{"class":242},[237,1234,1236,1238,1240],{"class":148,"line":1235},67,[237,1237,1089],{"class":242},[237,1239,232],{"class":246},[237,1241,254],{"class":242},[20,1243,1244,1245,1248],{},"The pause outline is the part to study. A polygon is a single closed path, so two separate bars have to be drawn as one outline that visits both: down the left bar, along the bottom to the right bar, up and round it, and back along the bottom to the start. The two runs along the bottom edge lie on top of each other in opposite directions, so they enclose no area and the gap between the bars stays empty under the default ",[15,1246,1247],{},"nonzero"," fill rule. The play state uses the same trick in a different place: points two to five run down a zero-width slit in the middle of the triangle and back up. During the morph the left bar widens into the left half of the triangle, the right bar narrows into its tip, and the slit and the bottom run shrink to nothing — every point has a short, direct path, which is what keeps the middle frames clean.",[20,1250,1251,1252,1255,1256,1259,1260,1263],{},"The checkbox's ",[15,1253,1254],{},"aria-label=\"Playing\""," combined with its checked state gives screen readers \"Playing, checkbox, checked\" or \"not checked\". In production, a ",[15,1257,1258],{},"\u003Cbutton>"," with ",[15,1261,1262],{},"aria-pressed"," toggled by script is the more conventional control; the CSS-only checkbox is shown here because the morph itself needs no script.",[38,1265,1267],{"id":1266},"the-key-technique-design-the-in-between-frames","The key technique: design the in-between frames",[20,1269,1270],{},"A morph is judged by its middle, not its ends. Because each point moves in a straight line at the same eased progress, the halfway frame is simply the average of the two point lists. Sketching that average before building the animation catches most problems.",[79,1272,86,1275,86,1278,86,1281,86,1284,86,1288,86,1293,86,1296,86,1299,86,1303,86,1308,86,1311,86,1315,86,1319,86,1325],{"viewBox":1273,"role":82,"ariaLabel":1274,"xmlns":84,"style":85},"0 0 720 290","Start, midpoint and end frames of a play-to-pause morph with well-matched points, and a twisted midpoint from mismatched order",[88,1276,1277],{},"Checking the midpoint frame",[92,1279,1280],{},"Top row: the play triangle, a clean midpoint where the triangle splits into two slanted bars, and the pause bars. Bottom: a midpoint from mismatched point order in which edges cross into a bow-tie shape.",[96,1282,1283],{"textAnchor":98,"x":99,"y":100,"style":101},"The 50% frame is the average of both point lists",[104,1285],{"points":1286,"fill":107,"opacity":1287},"100,50 180,95 100,140","0.55",[96,1289,1292],{"textAnchor":98,"x":1290,"y":1291,"style":145},"140","164","0%",[104,1294],{"points":1295,"fill":107,"opacity":1287},"310,50 336,62 336,128 310,140",[104,1297],{"points":1298,"fill":107,"opacity":1287},"350,58 380,78 380,112 350,132",[96,1300,1302],{"textAnchor":98,"x":1301,"y":1291,"style":145},"345","50%: clean",[1304,1305],"rect",{"x":1306,"y":126,"width":100,"height":1307,"fill":107,"opacity":1287},"520","90",[1304,1309],{"x":1310,"y":126,"width":100,"height":1307,"fill":107,"opacity":1287},"566",[96,1312,1314],{"textAnchor":98,"x":1313,"y":1291,"style":145},"556","100%",[104,1316],{"points":1317,"fill":107,"opacity":1318,"stroke":109,"strokeWidth":110},"310,190 380,270 380,190 310,270","0.4",[96,1320,1324],{"textAnchor":131,"x":1321,"y":1322,"style":1323},"440","226","text-anchor:start;fill:currentColor;font:12px sans-serif","mismatched order at 50%:",[96,1326,1328],{"textAnchor":131,"x":1321,"y":1327,"style":1323},"246","edges cross into a bow tie",[20,1330,1331],{},"Three habits make midpoints reliable:",[1333,1334,1335,1342,1348],"ol",{},[1336,1337,1338,1341],"li",{},[191,1339,1340],{},"Write coordinates in percentages"," so the morph scales with the element and you can reason about positions on a 0–100 grid.",[1336,1343,1344,1347],{},[191,1345,1346],{},"Keep points convex where possible."," Shapes whose vertices all bulge outward rarely self-intersect mid-morph. Concave shapes, like stars, need more care with order.",[1336,1349,1350,1353,1354,1357],{},[191,1351,1352],{},"Use an easing curve with some acceleration at both ends",", such as ",[15,1355,1356],{},"cubic-bezier(0.65, 0, 0.35, 1)",". Morphs look mechanical under linear timing and rushed under a strong ease-out, because the interesting middle frames fly past.",[20,1359,1360],{},"For a star, list outer and inner points alternately — outer, inner, outer, inner — and pad the other shape to the same alternating structure. A square morphing into a five-pointed star then needs ten points, with its padding placed so that \"inner\" points start on the square's edges near their final positions.",[38,1362,1364],{"id":1363},"variation-a-disclosure-chevron-that-flips","Variation: a disclosure chevron that flips",[20,1366,1367],{},"Not every morph needs extra points. A thick chevron that flips from pointing down to pointing up is a six-point polygon in both states, and mirroring the points vertically gives a morph whose middle frame collapses to a flat line — a quick, convincing flip without any rotation.",[228,1369,1373],{"className":1370,"code":1371,"language":1372,"meta":233,"style":233},"language-css shiki shiki-themes github-light-high-contrast github-dark-high-contrast",".chevron {\n  width: 1.25rem;\n  height: 1.25rem;\n  background: currentColor;\n  \u002F* A thick V pointing down: outer edge 1-2-3, inner edge 4-5-6. *\u002F\n  clip-path: polygon(10% 30%, 50% 70%, 90% 30%, 90% 48%, 50% 88%, 10% 48%);\n  transition: clip-path 0.25s cubic-bezier(0.65, 0, 0.35, 1);\n}\n\n\u002F* Pointing up: every point mirrored top to bottom (y becomes 100% - y).\n   Each point moves straight up or down, so edges never cross; halfway\n   through, all six points sit on the same line and the shape is flat. *\u002F\n[aria-expanded=\"true\"] > .chevron {\n  clip-path: polygon(10% 70%, 50% 30%, 90% 70%, 90% 52%, 50% 12%, 10% 52%);\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .chevron { transition: none; }\n}\n","css",[15,1374,1375,1382,1396,1409,1420,1425,1501,1533,1538,1542,1547,1552,1557,1580,1652,1656,1660,1667,1682],{"__ignoreMap":233},[237,1376,1377,1380],{"class":148,"line":239},[237,1378,1379],{"class":250},".chevron",[237,1381,488],{"class":242},[237,1383,1384,1387,1389,1392,1394],{"class":148,"line":257},[237,1385,1386],{"class":250},"  width",[237,1388,366],{"class":242},[237,1390,1391],{"class":250},"1.25",[237,1393,399],{"class":372},[237,1395,502],{"class":242},[237,1397,1398,1401,1403,1405,1407],{"class":148,"line":277},[237,1399,1400],{"class":250},"  height",[237,1402,366],{"class":242},[237,1404,1391],{"class":250},[237,1406,399],{"class":372},[237,1408,502],{"class":242},[237,1410,1411,1414,1416,1418],{"class":148,"line":287},[237,1412,1413],{"class":250},"  background",[237,1415,366],{"class":242},[237,1417,109],{"class":250},[237,1419,502],{"class":242},[237,1421,1422],{"class":148,"line":305},[237,1423,1424],{"class":470},"  \u002F* A thick V pointing down: outer edge 1-2-3, inner edge 4-5-6. *\u002F\n",[237,1426,1427,1430,1432,1434,1436,1439,1441,1444,1446,1448,1450,1452,1455,1457,1459,1461,1463,1465,1467,1469,1471,1473,1476,1478,1480,1482,1484,1487,1489,1491,1493,1495,1497,1499],{"class":148,"line":330},[237,1428,1429],{"class":250},"  clip-path",[237,1431,366],{"class":242},[237,1433,104],{"class":250},[237,1435,754],{"class":242},[237,1437,1438],{"class":250},"10",[237,1440,641],{"class":372},[237,1442,1443],{"class":250}," 30",[237,1445,641],{"class":372},[237,1447,52],{"class":242},[237,1449,126],{"class":250},[237,1451,641],{"class":372},[237,1453,1454],{"class":250}," 70",[237,1456,641],{"class":372},[237,1458,52],{"class":242},[237,1460,1307],{"class":250},[237,1462,641],{"class":372},[237,1464,1443],{"class":250},[237,1466,641],{"class":372},[237,1468,52],{"class":242},[237,1470,1307],{"class":250},[237,1472,641],{"class":372},[237,1474,1475],{"class":250}," 48",[237,1477,641],{"class":372},[237,1479,52],{"class":242},[237,1481,126],{"class":250},[237,1483,641],{"class":372},[237,1485,1486],{"class":250}," 88",[237,1488,641],{"class":372},[237,1490,52],{"class":242},[237,1492,1438],{"class":250},[237,1494,641],{"class":372},[237,1496,1475],{"class":250},[237,1498,641],{"class":372},[237,1500,773],{"class":242},[237,1502,1503,1506,1508,1511,1513,1515,1517,1519,1521,1523,1525,1527,1529,1531],{"class":148,"line":344},[237,1504,1505],{"class":250},"  transition",[237,1507,743],{"class":242},[237,1509,1510],{"class":250},"0.25",[237,1512,748],{"class":372},[237,1514,751],{"class":250},[237,1516,754],{"class":242},[237,1518,757],{"class":250},[237,1520,52],{"class":242},[237,1522,541],{"class":250},[237,1524,52],{"class":242},[237,1526,766],{"class":250},[237,1528,52],{"class":242},[237,1530,165],{"class":250},[237,1532,773],{"class":242},[237,1534,1535],{"class":148,"line":354},[237,1536,1537],{"class":242},"}\n",[237,1539,1540],{"class":148,"line":405},[237,1541,409],{"emptyLinePlaceholder":408},[237,1543,1544],{"class":148,"line":412},[237,1545,1546],{"class":470},"\u002F* Pointing up: every point mirrored top to bottom (y becomes 100% - y).\n",[237,1548,1549],{"class":148,"line":462},[237,1550,1551],{"class":470},"   Each point moves straight up or down, so edges never cross; halfway\n",[237,1553,1554],{"class":148,"line":467},[237,1555,1556],{"class":470},"   through, all six points sit on the same line and the shape is flat. *\u002F\n",[237,1558,1559,1562,1565,1567,1569,1572,1575,1578],{"class":148,"line":474},[237,1560,1561],{"class":242},"[",[237,1563,1564],{"class":250},"aria-expanded",[237,1566,268],{"class":372},[237,1568,1180],{"class":271},[237,1570,1571],{"class":242},"] ",[237,1573,1574],{"class":372},">",[237,1576,1577],{"class":250}," .chevron",[237,1579,488],{"class":242},[237,1581,1582,1584,1586,1588,1590,1592,1594,1596,1598,1600,1602,1604,1606,1608,1610,1612,1614,1616,1618,1620,1622,1624,1627,1629,1631,1633,1635,1638,1640,1642,1644,1646,1648,1650],{"class":148,"line":480},[237,1583,1429],{"class":250},[237,1585,366],{"class":242},[237,1587,104],{"class":250},[237,1589,754],{"class":242},[237,1591,1438],{"class":250},[237,1593,641],{"class":372},[237,1595,1454],{"class":250},[237,1597,641],{"class":372},[237,1599,52],{"class":242},[237,1601,126],{"class":250},[237,1603,641],{"class":372},[237,1605,1443],{"class":250},[237,1607,641],{"class":372},[237,1609,52],{"class":242},[237,1611,1307],{"class":250},[237,1613,641],{"class":372},[237,1615,1454],{"class":250},[237,1617,641],{"class":372},[237,1619,52],{"class":242},[237,1621,1307],{"class":250},[237,1623,641],{"class":372},[237,1625,1626],{"class":250}," 52",[237,1628,641],{"class":372},[237,1630,52],{"class":242},[237,1632,126],{"class":250},[237,1634,641],{"class":372},[237,1636,1637],{"class":250}," 12",[237,1639,641],{"class":372},[237,1641,52],{"class":242},[237,1643,1438],{"class":250},[237,1645,641],{"class":372},[237,1647,1626],{"class":250},[237,1649,641],{"class":372},[237,1651,773],{"class":242},[237,1653,1654],{"class":148,"line":491},[237,1655,1537],{"class":242},[237,1657,1658],{"class":148,"line":505},[237,1659,409],{"emptyLinePlaceholder":408},[237,1661,1662,1665],{"class":148,"line":519},[237,1663,1664],{"class":372},"@media",[237,1666,1061],{"class":242},[237,1668,1669,1672,1674,1676,1678,1680],{"class":148,"line":533},[237,1670,1671],{"class":250},"  .chevron",[237,1673,360],{"class":242},[237,1675,62],{"class":250},[237,1677,366],{"class":242},[237,1679,1076],{"class":250},[237,1681,402],{"class":242},[237,1683,1684],{"class":148,"line":546},[237,1685,1537],{"class":242},[20,1687,1688,1689,1691,1692,1695,1696,389,1699,1703],{},"The chevron sits inside a disclosure button whose ",[15,1690,1564],{}," attribute carries the real state, and the shape follows the attribute, so the visual and accessible states cannot disagree. Because each point moves along a single axis, this morph is also the easiest kind to verify: sketch the halfway frame and it is a straight horizontal line, with nothing to twist. The same mirroring idea gives sort-direction arrows and expand\u002Fcollapse carets. When a rotation would do the job just as well, ",[15,1693,1694],{},"transform: rotate()"," is cheaper to animate than ",[15,1697,1698],{},"clip-path",[27,1700,1702],{"href":1701},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fsmooth-hover-effects-without-javascript\u002F","Smooth Hover Effects Without JavaScript"," covers the transform-based approach.",[38,1705,1707],{"id":1706},"browser-support","Browser support",[20,1709,1710,1711,1713,1714,1717],{},"Animating ",[15,1712,17],{}," between polygons with equal point counts is supported in current versions of Chrome, Edge, Firefox and Safari. In an engine that cannot interpolate a given pair — for example, mismatched counts — the shape switches at the end of the transition rather than failing, so the state change is still visible. ",[15,1715,1716],{},"prefers-reduced-motion"," is supported in Chrome 74+, Edge 79+, Firefox 63+ and Safari 10.1+; under reduced motion the icon switches shape instantly.",[38,1719,1721],{"id":1720},"faq","FAQ",[20,1723,1724,1727,1728,1730],{},[191,1725,1726],{},"Why does my polygon morph jump instead of animating?","\nThe two polygons have different numbers of points. ",[15,1729,197],{}," only interpolates when both states list exactly the same number of vertices. Add duplicate points to the simpler shape until the counts match, placing them where they will spread out naturally.",[20,1732,1733,1736],{},[191,1734,1735],{},"Why does my morph twist or cross over itself halfway through?","\nThe points are listed in different orders or start from different corners. Each point travels in a straight line to the point at the same index, so if point one is the top of one shape and the left of the other, edges cross mid-animation. Start both lists at the same position and go round in the same direction.",[20,1738,1739,1745,1746,1748,1749,1752,1753,1756,1757,1752,1760,1763,1764,1766],{},[191,1740,1741,1742,1744],{},"Can ",[15,1743,1698],{}," morph between curved shapes?","\nNot with ",[15,1747,197],{},", which only draws straight edges. ",[15,1750,1751],{},"circle()"," and ",[15,1754,1755],{},"ellipse()"," morph among themselves, and the ",[15,1758,1759],{},"shape()",[15,1761,1762],{},"path()"," functions can describe curves, but ",[15,1765,1762],{}," only interpolates when both paths have identical command structures. For most UI morphs, a polygon with enough points is simpler.",[20,1768,1769,1772,1773,1775,1776,1778],{},[191,1770,1771],{},"Should a morphing icon still have a text label?","\nYes. A shape change such as play becoming pause conveys state visually, but screen readers need the state in text. Keep an accessible name that updates with the state, for example through a label that changes with ",[15,1774,55],{},", or ",[15,1777,1262],{}," on a button.",[38,1780,1782],{"id":1781},"related","Related",[1784,1785,1786,1791,1798,1805],"ul",{},[1336,1787,1788,1790],{},[27,1789,30],{"href":29}," — the parent guide.",[1336,1792,1793,1797],{},[27,1794,1796],{"href":1795},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fclip-path-reveal-animations\u002F","Clip-Path Reveal Animations"," — polygon interpolation used for reveals.",[1336,1799,1800,1804],{},[27,1801,1803],{"href":1802},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-toggle-switches-and-checkboxes\u002F","CSS-Only Toggle Switches and Checkboxes"," — the checkbox state pattern behind the toggle.",[1336,1806,1807,1811],{},[27,1808,1810],{"href":1809},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances\u002F","Container Query Hover Affordances"," — scaling icon motion to its container.",[349,1813,1814],{},"html pre.shiki code .suds8, html code.shiki .suds8{--shiki-default:#0E1116;--shiki-dark:#F0F3F6}html pre.shiki code .sne4z, html code.shiki .sne4z{--shiki-default:#024C1A;--shiki-dark:#72F088}html pre.shiki code .s-5SL, html code.shiki .s-5SL{--shiki-default:#023B95;--shiki-dark:#91CBFF}html pre.shiki code .sT6z2, html code.shiki .sT6z2{--shiki-default:#032563;--shiki-dark:#ADDCFF}html pre.shiki code .sHUrx, html code.shiki .sHUrx{--shiki-default:#A0111F;--shiki-dark:#FF9492}html pre.shiki code .sLBg1, html code.shiki .sLBg1{--shiki-default:#66707B;--shiki-dark:#BDC4CC}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":233,"searchDepth":257,"depth":257,"links":1816},[1817,1818,1819,1820,1821,1822,1823,1824],{"id":40,"depth":257,"text":41},{"id":76,"depth":257,"text":77},{"id":218,"depth":257,"text":219},{"id":1266,"depth":257,"text":1267},{"id":1363,"depth":257,"text":1364},{"id":1706,"depth":257,"text":1707},{"id":1720,"depth":257,"text":1721},{"id":1781,"depth":257,"text":1782},"Morph between triangles, hexagons, stars and icons with clip-path polygon(): equalise point counts, keep point order aligned and avoid twisted middle frames.","md",{"pageTitle":1828,"datePublished":1829,"dateModified":1829,"faq":1830},"Morphing Shapes With clip-path polygon()","2026-09-18",[1831,1833,1835,1838],{"q":1726,"a":1832},"The two polygons have different numbers of points. polygon() only interpolates when both states list exactly the same number of vertices. Add duplicate points to the simpler shape until the counts match, placing them where they will spread out naturally.",{"q":1735,"a":1834},"The points are listed in different orders or start from different corners. Each point travels in a straight line to the point at the same index, so if point one is the top of one shape and the left of the other, edges cross mid-animation. Start both lists at the same position and go round in the same direction.",{"q":1836,"a":1837},"Can clip-path morph between curved shapes?","Not with polygon(), which only draws straight edges. circle() and ellipse() morph among themselves, and the shape() and path() functions can describe curves, but path() only interpolates when both paths have identical command structures. For most UI morphs, a polygon with enough points is simpler.",{"q":1771,"a":1839},"Yes. A shape change such as play becoming pause conveys state visually, but screen readers need the state in text. Keep an accessible name that updates with the state, for example through a label that changes with :checked, or aria-pressed on a button.","\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmorphing-shapes-with-clip-path-polygon",{"title":5,"description":1825},"css-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmorphing-shapes-with-clip-path-polygon\u002Findex","gQdpaIJum54VMo71vNGsy3fz6Ys99P57ci_OaHKYt1A",[1845,1848,1851,1854,1857,1860,1863,1866,1869,1872,1875,1878,1881,1884,1887,1888,1891,1894,1897,1900,1903,1906,1909,1912,1915,1918,1921,1924,1927,1930,1933,1936,1939,1942,1945,1948,1951,1954,1957,1960,1963,1966,1969,1972,1975,1978,1981,1984,1987,1990,1993,1996,1999,2002,2005,2008,2011,2014,2017,2020,2023,2026,2029,2032,2035,2038,2041,2044,2047,2050,2053,2056,2059,2062,2065,2068,2071,2074,2077,2080,2083,2086,2089,2092,2095,2098,2101,2104,2107,2110,2113,2116,2119,2122,2124,2127,2130,2133,2136,2139,2142,2145,2148,2151,2154,2157,2160,2163,2166,2169,2172,2175,2178,2181,2184,2187,2190,2193,2196,2199,2202,2205,2208,2211,2214,2217,2220,2223,2226,2229,2232,2235,2238,2241,2244,2247,2250,2253,2256,2259,2262,2265,2268,2271,2274,2277,2280,2283,2286,2289,2292,2295,2298,2301,2304,2307,2310,2313,2316,2319,2322,2325,2328,2331,2334,2337,2340,2343,2346,2349,2352,2355,2358,2361,2364,2367,2370,2373,2376,2379,2382,2385,2388,2391,2394,2397,2400],{"path":1846,"title":1847},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fcreating-accessible-focus-indicators","Creating Accessible Focus Indicators: Building a Ring That Survives Any Background",{"path":1849,"title":1850},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fflashing-content-and-seizure-thresholds","Flashing Content and Seizure Thresholds",{"path":1852,"title":1853},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fforced-colors-mode-and-animations","Forced Colors Mode and Animations",{"path":1855,"title":1856},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations","Accessibility in CSS Animations: Patterns, Specs & Best Practices",{"path":1858,"title":1859},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fpause-controls-for-looping-animations","Pause Controls for Looping CSS Animations: Meeting WCAG 2.2.2",{"path":1861,"title":1862},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fprefers-reduced-motion-recipes","prefers-reduced-motion Recipes: A Reduction for Every Common Effect",{"path":1864,"title":1865},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Freducing-motion-preferences-in-css","Reducing Motion Preferences in CSS: How the Setting Becomes a Media Feature",{"path":1867,"title":1868},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Ftarget-size-and-pointer-accessibility","Target Size and Pointer Accessibility: Meeting 2.5.8 Without Redesigning",{"path":1870,"title":1871},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fvestibular-safe-animation-patterns","Vestibular-Safe Animation Patterns: Why Some Motion Makes People Sick",{"path":1873,"title":1874},"\u002Fcss-only-micro-interactions-animations\u002Faccessibility-in-css-animations\u002Fwcag-motion-success-criteria","WCAG Motion Success Criteria: What Each One Actually Requires",{"path":1876,"title":1877},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fanimated-gradient-borders-with-property","Animated Gradient Borders With @property: A Spinning Highlight Without Extra Elements",{"path":1879,"title":1880},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fclip-path-reveal-animations","Clip-Path Reveal Animations: Wipes, Irises and Corners Without Extra Markup",{"path":1882,"title":1883},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations","Clip-Path & Mask Animations: Animating Visibility Instead of Position",{"path":1885,"title":1886},"\u002Fcss-only-micro-interactions-animations\u002Fclip-path-and-mask-animations\u002Fmask-image-fade-edges","Fading Edges With mask-image: Soft Boundaries That Work on Any Background",{"path":1840,"title":5},{"path":1889,"title":1890},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fanimating-gradients","Animating CSS Gradients: Smooth Colour Motion Without Jumps",{"path":1892,"title":1893},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fcolor-mix-hover-states","Hover and Active States With color-mix(): One Token, Every Shade",{"path":1895,"title":1896},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions","Color & Theme Transitions: Colour as Part of the Motion System",{"path":1898,"title":1899},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Flight-dark-function-for-themes","Light and Dark Themes With light-dark(): One Declaration per Colour",{"path":1901,"title":1902},"\u002Fcss-only-micro-interactions-animations\u002Fcolor-and-theme-transitions\u002Fsmooth-theme-switching-transitions","Smooth Theme Switching: Crossfades, Circular Reveals and No Flash",{"path":1904,"title":1905},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fcontainer-query-hover-affordances","Container Query Hover Affordances: When Narrow Means Persistent, Not Hidden",{"path":1907,"title":1908},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion","Container-Aware Motion: Animation Sized by the Space a Component Actually Has",{"path":1910,"title":1911},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Flayout-change-animations-at-container-breakpoints","Animating Changes at Container Breakpoints",{"path":1913,"title":1914},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-driven-by-container-style-queries","Motion Driven by Container Style Queries",{"path":1916,"title":1917},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fmotion-that-scales-with-container-size","Motion That Scales with Container Size: cqi, cqb, and Derived Durations",{"path":1919,"title":1920},"\u002Fcss-only-micro-interactions-animations\u002Fcontainer-aware-motion\u002Fsuppressing-motion-in-small-containers","Suppressing Motion in Small Containers: Deliberately Animating Nothing",{"path":1922,"title":1923},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fcontrolling-css-animations-from-javascript","Controlling CSS Animations From JavaScript",{"path":1925,"title":1926},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api","CSS Animation vs the Web Animations API: A Decision Guide",{"path":1928,"title":1929},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwaapi-vs-css-for-interruptible-ui","Interruptible UI: CSS Transitions vs WAAPI",{"path":1931,"title":1932},"\u002Fcss-only-micro-interactions-animations\u002Fcss-animation-vs-web-animations-api\u002Fwhen-to-use-javascript-animation","When to Use JavaScript Instead of CSS for Animation",{"path":1934,"title":1935},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fanimating-custom-properties-with-at-property","Animating Custom Properties with @property: Typed Variables That Interpolate",{"path":1937,"title":1938},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fcustom-property-fallbacks-and-invalid-values","Custom Property Fallbacks and Invalid Values",{"path":1940,"title":1941},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Ffluid-spacing-tokens-driving-transition-durations","Fluid Spacing Tokens That Drive Transition Durations",{"path":1943,"title":1944},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture","CSS Custom Properties Architecture: Scalable Design Systems & Dynamic UI",{"path":1946,"title":1947},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fregistered-properties-and-type-safety","Registered Properties and Type Safety: @property as a Contract for Design Tokens",{"path":1949,"title":1950},"\u002Fcss-only-micro-interactions-animations\u002Fcss-custom-properties-architecture\u002Fscoping-custom-properties-to-components","Scoping Custom Properties to Components",{"path":1952,"title":1953},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fcss-transition-timing-functions","CSS Transition Timing Functions: ease, cubic-bezier(), steps() and linear()",{"path":1955,"title":1956},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals","CSS Transition Fundamentals: Architecture, Performance & Patterns",{"path":1958,"title":1959},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Finterrupted-and-reversing-transitions","Interrupted and Reversing Transitions: What Happens Mid-Flight",{"path":1961,"title":1962},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Fstarting-style-entry-animations","@starting-style: Animating an Element's Very First Style Change",{"path":1964,"title":1965},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-delay-choreography","Choreographing Motion With transition-delay",{"path":1967,"title":1968},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransition-shorthand-and-multiple-properties","The transition Shorthand and Multiple Properties",{"path":1970,"title":1971},"\u002Fcss-only-micro-interactions-animations\u002Fcss-transition-fundamentals\u002Ftransitioning-display-with-allow-discrete","Transitioning display with transition-behavior: allow-discrete and @starting-style",{"path":1973,"title":1974},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fanimating-dialog-open-and-close","Animating \u003Cdialog> Open and Close: Both Directions, No Library",{"path":1976,"title":1977},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fbackdrop-animations","Animating ::backdrop: Fades and Blurs Behind Dialogs and Popovers",{"path":1979,"title":1980},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations","Dialog & Popover Animations: Motion for the Top Layer",{"path":1982,"title":1983},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Finterpolate-size-for-height-auto-animation","Animating to height: auto With interpolate-size and calc-size()",{"path":1985,"title":1986},"\u002Fcss-only-micro-interactions-animations\u002Fdialog-and-popover-animations\u002Fpopover-entry-and-exit-transitions","Popover Menus That Animate From Their Anchor",{"path":1988,"title":1989},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fchoosing-animation-durations","Choosing Animation Durations: How Long Motion Should Last",{"path":1991,"title":1992},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fcubic-bezier-overshoot-and-anticipation","Overshoot and Anticipation With cubic-bezier(): Motion With Character",{"path":1994,"title":1995},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fentry-vs-exit-easing","Entry vs Exit Easing: Different Curves for Arriving and Leaving",{"path":1997,"title":1998},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design","Easing & Motion Design: Making CSS Motion Feel Intentional",{"path":2000,"title":2001},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Flinear-easing-function-for-springs","Spring and Bounce Easing With linear(): Physical Motion Without JavaScript",{"path":2003,"title":2004},"\u002Fcss-only-micro-interactions-animations\u002Feasing-and-motion-design\u002Fsteps-easing-for-sprite-animations","steps() Easing: Sprite Sheets, Typewriters and Other Frame-by-Frame Effects",{"path":2006,"title":2007},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Faccessible-css-only-tooltips","Accessible CSS-Only Tooltips and Hover Cards With  and ",{"path":2009,"title":2010},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fbutton-press-and-active-states","Button Press and  States",{"path":2012,"title":2013},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-visible-vs-focus-polyfill-alternatives"," vs :focus: Why It Replaced the Focus-Ring Polyfill",{"path":2015,"title":2016},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Ffocus-within-form-patterns"," Form Patterns: Styling a Group From the Field Inside It",{"path":2018,"title":2019},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fhover-intent-delays-with-transition-delay","Hover Intent Delays With transition-delay: Menus That Don't Flicker",{"path":2021,"title":2022},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design","Hover & Focus State Design: Spec-Compliant Patterns for Modern UIs",{"path":2024,"title":2025},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fpointer-and-hover-media-queries","Pointer and Hover Media Queries: Gating Affordances by Input Capability",{"path":2027,"title":2028},"\u002Fcss-only-micro-interactions-animations\u002Fhover-focus-state-design\u002Fsmooth-hover-effects-without-javascript","Smooth Hover Effects Without JavaScript: CSS-Only Patterns for Modern UI",{"path":2030,"title":2031},"\u002Fcss-only-micro-interactions-animations","CSS-Only Micro-Interactions & Animations: Architecture, Performance & Implementation",{"path":2033,"title":2034},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-composition-and-stacking","Stacking Animations With animation-composition",{"path":2036,"title":2037},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fanimation-fill-mode-explained","animation-fill-mode: What an Animation Applies Before and After It Runs",{"path":2039,"title":2040},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcontainer-query-triggered-keyframe-animations","Container-Query-Triggered Keyframe Animations: Animate Differently per Available Space",{"path":2042,"title":2043},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-accordions-and-disclosure","CSS-Only Accordions and Disclosure Widgets with details and summary",{"path":2045,"title":2046},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-loading-spinners-and-skeletons","CSS-Only Loading Spinners and Skeleton Shimmer Screens with @keyframes",{"path":2048,"title":2049},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fcss-only-toggle-switches-and-checkboxes","CSS-Only Toggle Switches and Checkboxes That Keep the Native Input",{"path":2051,"title":2052},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns","Keyframe Animation Patterns: Spec-Compliant Architectures for Modern UIs",{"path":2054,"title":2055},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fmulti-step-keyframes-and-per-keyframe-easing","Multi-Step Keyframes and Per-Keyframe Easing",{"path":2057,"title":2058},"\u002Fcss-only-micro-interactions-animations\u002Fkeyframe-animation-patterns\u002Fstaggered-list-animations-with-custom-properties","Staggered List Animations Using --i Index Custom Properties",{"path":2060,"title":2061},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fanimating-box-shadow-and-filters-cheaply","Animating box-shadow and Filters Cheaply",{"path":2063,"title":2064},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcontain-property-for-animation-performance","The contain Property for Animation Performance",{"path":2066,"title":2067},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fcss-triggers-layout-paint-composite","Layout, Paint and Composite: What Triggers What",{"path":2069,"title":2070},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration","Performance & GPU Acceleration in CSS: A Developer’s Blueprint",{"path":2072,"title":2073},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Foptimizing-css-animations-for-60fps","Optimizing CSS Animations for 60fps: Budgeting the Frame",{"path":2075,"title":2076},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fprofiling-animations-in-devtools","Profiling CSS Animations in DevTools: Finding the Frame That Costs Too Much",{"path":2078,"title":2079},"\u002Fcss-only-micro-interactions-animations\u002Fperformance-gpu-acceleration\u002Fwill-change-and-the-compositor-thread","will-change and the Compositor Thread: Layer Promotion Without the Footguns",{"path":2081,"title":2082},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations","Scroll-Driven Animations: Binding Motion to Scroll Position in Pure CSS",{"path":2084,"title":2085},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-animation-fallbacks","Shipping Scroll-Driven Animations Without Breaking Anything",{"path":2087,"title":2088},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-driven-parallax-effects","Scroll-Driven Parallax Effects in CSS",{"path":2090,"title":2091},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-progress-bar-without-javascript","A Reading Progress Bar Driven by scroll(root)",{"path":2093,"title":2094},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fscroll-triggered-reveal-animations","Reveal-on-Scroll with view() and animation-range",{"path":2096,"title":2097},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Ftimeline-scope-for-cross-element-animations","timeline-scope for Cross-Element Animations",{"path":2099,"title":2100},"\u002Fcss-only-micro-interactions-animations\u002Fscroll-driven-animations\u002Fview-timeline-and-animation-range","View Timelines and animation-range",{"path":2102,"title":2103},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fcross-document-view-transitions","Cross-Document View Transitions",{"path":2105,"title":2106},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers","View Transitions for CSS Developers: the Pseudo-Element Tree, Snapshots, and Named Elements",{"path":2108,"title":2109},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fsame-document-view-transitions","Writing a Same-Document View Transition: the CSS You Actually Author",{"path":2111,"title":2112},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-names-shared-elements","view-transition-name and Shared Elements: Morphing a Thumbnail into a Hero",{"path":2114,"title":2115},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transition-types-and-classes","View Transition Types and Classes",{"path":2117,"title":2118},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-for-list-reordering","View Transitions for List Reordering",{"path":2120,"title":2121},"\u002Fcss-only-micro-interactions-animations\u002Fview-transitions-for-css-developers\u002Fview-transitions-with-reduced-motion","Honouring prefers-reduced-motion in View Transitions",{"path":376,"title":2123},"Modern CSS Layouts & Micro-Interactions",{"path":2125,"title":2126},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioned-tooltips","Anchor-Positioned Tooltips: Tethering, Flipping, and Getting the Semantics Right",{"path":2128,"title":2129},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-positioning-fallbacks","Anchor Positioning Fallbacks: A Graceful Floor for Older Browser Versions",{"path":2131,"title":2132},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fanchor-size-for-matching-widths","anchor-size(): Overlays That Match Their Trigger's Size",{"path":2134,"title":2135},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays","CSS Anchor Positioning and Overlays: Tethering Elements Without JavaScript",{"path":2137,"title":2138},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-attribute-and-css-styling","The popover Attribute: Top-Layer Overlays With No JavaScript",{"path":2140,"title":2141},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fpopover-light-dismiss-and-stacking","Popover Light Dismiss, Nesting and Stacking",{"path":2143,"title":2144},"\u002Fmastering-container-queries-responsive-layouts\u002Fanchor-positioning-and-overlays\u002Fposition-area-grid-explained","position-area: The Anchor Placement Grid",{"path":2146,"title":2147},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fcontainer-query-polyfill-tradeoffs","Container Query Polyfills: What They Cost and When to Skip Them",{"path":2149,"title":2150},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ffeature-detection-with-supports","Feature Detection with @supports: Syntax, Semantics, and the Traps",{"path":2152,"title":2153},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fhandling-container-query-fallbacks-for-older-browsers","Handling Container Query Fallbacks for Older Browsers",{"path":2155,"title":2156},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks","Container Query Fallbacks: Spec-Compliant CSS Strategies for Legacy Browsers",{"path":2158,"title":2159},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Fintrinsic-layout-fallbacks-without-queries","Intrinsic Layout Fallbacks: Baselines That Adapt Without Any Query",{"path":2161,"title":2162},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-fallbacks\u002Ftesting-fallbacks-without-old-browsers","Testing CSS Fallbacks Without an Old Browser",{"path":2164,"title":2165},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-queries-inside-css-nesting","Container Queries Inside CSS Nesting: Keeping Responses Next to the Styles They Change",{"path":2167,"title":2168},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-range-and-logic-operators","Container Query Range Syntax and Logic Operators",{"path":2170,"title":2171},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-query-units-cqi-cqb-explained","Container Query Units Explained: cqi, cqb, cqw, cqh, cqmin and cqmax",{"path":2173,"title":2174},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-type-size-vs-inline-size","Choosing container-type: inline-size, size, or normal",{"path":2176,"title":2177},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fcontainer-vs-media-queries-comparison","Container vs Media Queries: Choosing the Right Reference Box",{"path":2179,"title":2180},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fdebugging-container-queries-in-devtools","Debugging Container Queries in DevTools: Why a Rule Doesn't Match",{"path":2182,"title":2183},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fhow-to-use-container-queries-in-production","How to Use Container Queries in Production Without a Rewrite",{"path":2185,"title":2186},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics","Container Query Syntax Basics",{"path":2188,"title":2189},"\u002Fmastering-container-queries-responsive-layouts\u002Fcontainer-query-syntax-basics\u002Fnesting-and-naming-container-queries","Nesting and Naming Container Queries: Targeting the Right Ancestor",{"path":2191,"title":2192},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fauto-fit-minmax-responsive-grids","Responsive Grids with repeat(auto-fit, minmax())",{"path":2194,"title":2195},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fbuilding-a-dashboard-with-subgrid","Building a Responsive Dashboard Where Cards Align with Subgrid",{"path":2197,"title":2198},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-auto-flow-dense-packing","grid-auto-flow: dense for Packed Layouts",{"path":2200,"title":2201},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fgrid-template-areas-responsive-layouts","Responsive Layouts With grid-template-areas: Rearranging Regions by Name",{"path":2203,"title":2204},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fholy-grail-layout-with-grid","The Holy-Grail Layout with CSS Grid and Container Queries",{"path":2206,"title":2207},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts","CSS Grid and Subgrid Layouts for Responsive Interfaces",{"path":2209,"title":2210},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fmasonry-style-layouts-with-grid","Masonry-Style Layouts With the CSS That Ships Today",{"path":2212,"title":2213},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Foverlapping-elements-with-grid-stacking","Overlapping Elements With Grid Stacking: Layers Without position: absolute",{"path":2215,"title":2216},"\u002Fmastering-container-queries-responsive-layouts\u002Fcss-grid-and-subgrid-layouts\u002Fsubgrid-vs-nested-grid","Subgrid vs an Independently Nested Grid",{"path":2218,"title":2219},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fcentering-in-css-every-method","Centering in CSS: Every Modern Method and When Each One Breaks",{"path":2221,"title":2222},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-basis-vs-width","flex-basis vs width: Which Size a Flex Item Actually Starts From",{"path":2224,"title":2225},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-grow-and-flex-shrink-explained","flex-grow and flex-shrink Explained",{"path":2227,"title":2228},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflex-wrap-intrinsic-responsive-rows","Breakpoint-Free Responsive Rows With flex-wrap and flex-basis",{"path":2230,"title":2231},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fflexbox-gap-and-spacing","Flexbox gap vs Margins: Spacing Items Without Edge Hacks",{"path":2233,"title":2234},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns","Flexbox Layout Patterns: One-Dimensional Layout for Real Components",{"path":2236,"title":2237},"\u002Fmastering-container-queries-responsive-layouts\u002Fflexbox-layout-patterns\u002Fsticky-footer-with-flexbox-and-grid","Sticky Footer With Flexbox or Grid: Pinning the Footer on Short Pages",{"path":2239,"title":2240},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fclamp-vs-media-query-typography","clamp() Fluid Type vs Media-Query Step Typography: Tradeoffs and Anatomy",{"path":2242,"title":2243},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Fdebugging-clamp-values","Debugging clamp(): Values That Are Ignored, Stuck or Never Fluid",{"path":2245,"title":2246},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-line-height-and-measure","Fluid Line Height and Measure: Keeping Text Readable as It Scales",{"path":2248,"title":2249},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-space-scale-with-clamp","Building a Fluid Spacing Scale with clamp() and Container Units",{"path":2251,"title":2252},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-type-accessibility-and-zoom","Fluid Type, Accessibility and Zoom: The vw-Only Trap",{"path":2254,"title":2255},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ffluid-typography-without-javascript","Fluid Typography Without JavaScript: A Precision CSS Reference",{"path":2257,"title":2258},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp","Fluid Typography with clamp(): A Practical Guide for Modern CSS",{"path":2260,"title":2261},"\u002Fmastering-container-queries-responsive-layouts\u002Ffluid-typography-with-clamp\u002Ftext-wrap-balance-and-pretty","text-wrap: balance and pretty: Better Line Breaks Without Manual Breaks",{"path":2263,"title":2264},"\u002Fmastering-container-queries-responsive-layouts","Mastering Container Queries & Responsive Layouts",{"path":2266,"title":2267},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Faspect-ratio-for-responsive-media","Using aspect-ratio for Responsive Media and Preventing Layout Shift",{"path":2269,"title":2270},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fcontent-visibility-and-contain-intrinsic-size","content-visibility and contain-intrinsic-size: Rendering Only What Is Near the Screen",{"path":2272,"title":2273},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques","Intrinsic Sizing Techniques: Modern CSS Layouts for Responsive UI",{"path":2275,"title":2276},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Flayout-widths-with-min-max-clamp","Layout Widths With min(), max() and clamp(): Sizing Without Breakpoints",{"path":2278,"title":2279},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fmin-max-fit-content-explained","min-content, max-content, and fit-content() Explained",{"path":2281,"title":2282},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fobject-fit-and-object-position","object-fit and object-position: Images That Fit Any Box",{"path":2284,"title":2285},"\u002Fmastering-container-queries-responsive-layouts\u002Fintrinsic-sizing-techniques\u002Fpreventing-flex-and-grid-overflow","The min-width: auto Trap in Flex and Grid Layouts",{"path":2287,"title":2288},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-for-reset-and-tokens","Cascade Layers for Reset and Design Tokens",{"path":2290,"title":2291},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcascade-layers-vs-specificity-hacks","Cascade Layers vs Specificity Hacks: Ordering Instead of Escalating",{"path":2293,"title":2294},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fcss-scope-for-component-styles","@scope for Component Styles: Short Selectors That Cannot Leak",{"path":2296,"title":2297},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies","Modern CSS Reset Strategies: A Spec-Compliant Foundation",{"path":2299,"title":2300},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Frevert-layer-and-revert-keywords","initial, inherit, unset, revert and revert-layer: Undoing Styles Correctly",{"path":2302,"title":2303},"\u002Fmastering-container-queries-responsive-layouts\u002Fmodern-css-reset-strategies\u002Fwriting-a-minimal-modern-reset","Writing a Minimal Modern CSS Reset: Every Line Justified",{"path":2305,"title":2306},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fcontent-aware-card-layouts-with-has","Content-Aware Card Layouts With :has(): One Component, Many Shapes",{"path":2308,"title":2309},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fempty-and-loading-states-with-has","Empty and Loading States With ()",{"path":2311,"title":2312},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fform-validation-layouts-with-has","Form Validation Layouts With :has(): Styling Groups From Field State",{"path":2314,"title":2315},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-selector-performance",":has() Selector Performance: What Is Cheap, What Is Not, and How to Measure",{"path":2317,"title":2318},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fhas-vs-container-style-queries",":has() vs Container Style Queries: Discovered State and Published State",{"path":2320,"title":2321},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has","Parent-Aware Layouts With :has(): Letting Containers React to Their Contents",{"path":2323,"title":2324},"\u002Fmastering-container-queries-responsive-layouts\u002Fparent-aware-layouts-with-has\u002Fquantity-queries-with-has","Quantity Queries With :has(): Layouts That Respond to How Many Items There Are",{"path":2326,"title":2327},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fbuilding-responsive-cards-with-container-queries","Building Responsive Cards with Container Queries: A Production-Ready Guide",{"path":2329,"title":2330},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-data-tables","Container Query Data Tables: Reflowing Tables to Cards",{"path":2332,"title":2333},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fcontainer-query-sidebar-layouts","Container Query Sidebar Layouts That Travel Between Contexts",{"path":2335,"title":2336},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns","Responsive Component Patterns: Architecture & Implementation",{"path":2338,"title":2339},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-forms-with-container-queries","Responsive Forms with Container Queries: Reflow Without Losing the Wiring",{"path":2341,"title":2342},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-hero-sections-with-container-queries","Responsive Hero Sections With Container Queries",{"path":2344,"title":2345},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-navigation-without-media-queries","Responsive Navigation Without Media Queries Using Container Queries",{"path":2347,"title":2348},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Fresponsive-pricing-tables","Responsive Pricing Tables: Aligned Features, a Clear Recommendation, Any Width",{"path":2350,"title":2351},"\u002Fmastering-container-queries-responsive-layouts\u002Fresponsive-component-patterns\u002Ftabs-that-become-accordions","Tabs That Become an Accordion: One Component, Two Layouts",{"path":2353,"title":2354},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fcss-only-carousel-with-scroll-snap","A CSS-Only Carousel With Scroll Snap",{"path":2356,"title":2357},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fhorizontal-scrolling-card-rows","Horizontal Scrolling Card Rows: Swipeable Lists That Stay in Their Lane",{"path":2359,"title":2360},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts","Scroll Snap & Overflow Layouts: Designing Components That Scroll on Purpose",{"path":2362,"title":2363},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Foverscroll-behavior-for-nested-scrolling","overscroll-behavior: Taming Nested Scrolling, Pull-to-Refresh and Back-Swipe",{"path":2365,"title":2366},"\u002Fmastering-container-queries-responsive-layouts\u002Fscroll-snap-and-overflow-layouts\u002Fscroll-margin-and-scroll-padding-for-sticky-headers","scroll-margin and scroll-padding: Keeping Targets Clear of Sticky Headers",{"path":2368,"title":2369},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcombining-size-and-style-queries","Combining Size and Style Container Queries",{"path":2371,"title":2372},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fcontainer-style-query-theming","Container Style Query Theming: One Token Instead of a Variant Class Matrix",{"path":2374,"title":2375},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state","Style Queries and Container State: Token-Driven Component Variants",{"path":2377,"title":2378},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-queries-with-custom-properties","Style Queries With Custom Properties: Declaring, Inheriting, and Matching Tokens",{"path":2380,"title":2381},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-component-variants","Component Variants With Style Queries: One Token, Many Looks",{"path":2383,"title":2384},"\u002Fmastering-container-queries-responsive-layouts\u002Fstyle-queries-and-container-state\u002Fstyle-query-fallbacks-and-support","Style Query Fallbacks and Support: Designing for Older Browser Versions",{"path":2386,"title":2387},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fdvh-svh-lvh-mobile-viewport-units","dvh, svh and lvh: Choosing the Right Mobile Viewport Unit",{"path":2389,"title":2390},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Ffull-bleed-sections-in-constrained-layouts","Full-Bleed Sections in a Constrained Layout: Breaking Out Without Breaking the Page",{"path":2392,"title":2393},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout","Viewport Units & Mobile Layout: Designing for the Screen You Actually Get",{"path":2395,"title":2396},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fsafe-area-insets-for-notched-screens","Safe Area Insets: Designing Around Notches, Corners and Home Indicators",{"path":2398,"title":2399},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fviewport-units-vs-container-units","Viewport Units vs Container Units: Choosing the Right Reference Box",{"path":2401,"title":2402},"\u002Fmastering-container-queries-responsive-layouts\u002Fviewport-units-and-mobile-layout\u002Fvirtual-keyboard-and-interactive-widget","Layouts That Survive the Virtual Keyboard",{"title":2404,"caption":2405,"height":2406,"html":2407,"css":2408},"Play icon morphing into pause with matched polygons","Click the icon or focus it and press Space: eight points travel from the triangle halves to the two bars.",170,"\n\u003Clabel class=\"player\">\n  \u003Cinput type=\"checkbox\" aria-label=\"Playing\">\n  \u003Cspan class=\"player__icon\" aria-hidden=\"true\">\u003C\u002Fspan>\n  \u003Cspan class=\"player__label\" aria-hidden=\"true\">\u003C\u002Fspan>\n\u003C\u002Flabel>","\n.player { display: inline-flex; align-items: center; gap: 0.75rem; cursor: pointer; }\n.player input { position: absolute; width: 1px; height: 1px; opacity: 0; }\n.player__icon {\n  width: 3rem;\n  height: 3rem;\n  background: var(--demo-accent);\n  clip-path: polygon(20% 10%, 50% 27.5%, 50% 72.5%, 50% 72.5%, 50% 27.5%, 85% 50%, 85% 50%, 20% 90%);\n  transition: clip-path 0.3s cubic-bezier(0.65, 0, 0.35, 1);\n}\n.player input:checked + .player__icon {\n  clip-path: polygon(20% 10%, 42% 10%, 42% 90%, 58% 90%, 58% 10%, 80% 10%, 80% 90%, 20% 90%);\n}\n.player input:focus-visible + .player__icon { outline: 2px solid var(--demo-fg); outline-offset: 4px; }\n.player__label::before { content: \"Play\"; }\n.player input:checked ~ .player__label::before { content: \"Pause\"; }\n@media (prefers-reduced-motion: reduce) { .player__icon { transition: none; } }",1789717747076]