File size: 125,605 Bytes
25f22bf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 |
======================== CODE SNIPPETS ======================== TITLE: Incorrect Mobile Targeting with Tailwind CSS Breakpoints DESCRIPTION: This example demonstrates a common mistake when targeting mobile devices. Using `sm:text-center` will only apply the `text-center` style at the `sm` breakpoint (640px) and above, meaning text will NOT be centered on screens smaller than 640px. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <!-- This will only center text on screens 640px and wider, not on small screens --><div class="sm:text-center"></div> ``` ---------------------------------------- TITLE: Applying Responsive Breakpoints with Tailwind CSS DESCRIPTION: This snippet illustrates how to use Tailwind CSS's responsive variants (`md`, `lg`) to apply different styles based on screen width. It demonstrates creating a grid layout that adapts from 3 columns on mobile to 4 columns on medium screens and 6 columns on large screens. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div class="grid grid-cols-3 md:grid-cols-4 lg:grid-cols-6"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Correct Mobile-First Styling with Tailwind CSS DESCRIPTION: This example illustrates the correct mobile-first approach in Tailwind CSS. The `text-center` utility applies to all screen sizes by default (mobile-first), and then `sm:text-left` overrides it to left-align the text from the `sm` breakpoint (640px) and wider. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <!-- This will center text on mobile, and left align it on screens 640px and wider --><div class="text-center sm:text-left"></div> ``` ---------------------------------------- TITLE: Implement Responsive Touch Actions with Tailwind CSS DESCRIPTION: This snippet illustrates how to apply `touch-action` utilities conditionally based on screen size using Tailwind CSS responsive prefixes. The `md:touch-auto` class ensures that the `touch-auto` behavior is only applied at medium screen sizes and above, overriding the default `touch-pan-x` behavior for smaller screens. SOURCE: https://tailwindcss.com/docs/touch-action LANGUAGE: HTML CODE: ``` <div class="touch-pan-x md:touch-auto ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Responsive Content with Tailwind CSS Breakpoint Variants DESCRIPTION: Illustrates how to apply different content values based on screen size using Tailwind CSS responsive variants. The `md:` prefix ensures the utility is applied only at medium screen sizes and above, allowing for mobile-first design. SOURCE: https://tailwindcss.com/docs/content LANGUAGE: HTML CODE: ``` <p class="before:content-['Mobile'] md:before:content-['Desktop'] ..."></p> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Position Utilities DESCRIPTION: Explains how to apply position utilities conditionally based on screen size using responsive prefixes like `md:`, allowing for different positioning at various breakpoints. SOURCE: https://tailwindcss.com/docs/top-right-bottom-left LANGUAGE: HTML CODE: ``` <div class="top-4 md:top-6 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Rotation with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to use Tailwind CSS's responsive design features. By prefixing a utility class like `rotate-60` with a breakpoint variant such as `md:`, the rotation will only apply at medium screen sizes and above, overriding the default `rotate-45` for smaller screens. This allows for dynamic styling based on device width. SOURCE: https://tailwindcss.com/docs/rotate LANGUAGE: HTML CODE: ``` <img class="rotate-45 md:rotate-60 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Responsive flex-shrink with Tailwind CSS Breakpoints DESCRIPTION: Explains how to apply `flex-shrink` utilities conditionally based on screen sizes using responsive variants like `md:`, allowing for adaptive layouts across different devices. SOURCE: https://tailwindcss.com/docs/flex-shrink LANGUAGE: HTML CODE: ``` <div class="shrink md:shrink-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Add Viewport Meta Tag for Responsive Design DESCRIPTION: Ensures proper scaling and responsiveness across devices by setting the viewport width to the device width and the initial zoom level to 1.0. This is a fundamental step for any responsive web page. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <meta name="viewport" content="width=device-width, initial-scale=1.0" /> ``` ---------------------------------------- TITLE: Apply Responsive Cursor Styles with Tailwind CSS DESCRIPTION: Demonstrates how to use responsive variants like `md:` with `cursor` utilities to apply different cursor styles based on screen size, allowing for adaptive UI behavior. SOURCE: https://tailwindcss.com/docs/cursor LANGUAGE: html CODE: ``` <button class="cursor-not-allowed md:cursor-auto ..."> <!-- ... --></button> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Grid Column Design DESCRIPTION: Explains how to make grid column utilities responsive by prefixing them with breakpoint variants like `md:`. This allows for different column layouts to be applied only at specified screen sizes and above, adapting the design for various devices. SOURCE: https://tailwindcss.com/docs/grid-column LANGUAGE: HTML CODE: ``` <div class="col-span-2 md:col-span-6 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Font Smoothing with Tailwind CSS DESCRIPTION: This HTML example shows how to use responsive variants, such as `md:`, to conditionally apply font smoothing utilities based on screen size in Tailwind CSS. This allows for different font rendering behaviors across various device breakpoints. SOURCE: https://tailwindcss.com/docs/font-smoothing LANGUAGE: HTML CODE: ``` <p class="antialiased md:subpixel-antialiased ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive break-after Utility in HTML DESCRIPTION: Illustrates how to apply the `break-after` utility conditionally based on screen size using responsive prefixes like `md:`. This allows for different break behaviors at various breakpoints, enabling adaptive layouts. SOURCE: https://tailwindcss.com/docs/break-after LANGUAGE: HTML CODE: ``` <div class="break-after-column md:break-after-auto ..."> <!-- ... --> </div> ``` ---------------------------------------- TITLE: Apply Responsive Text Casing with Tailwind CSS DESCRIPTION: Illustrates how to apply `text-transform` utilities conditionally based on screen size using responsive prefixes like `md:` in Tailwind CSS. SOURCE: https://tailwindcss.com/docs/text-transform LANGUAGE: HTML CODE: ``` <p class="capitalize md:uppercase ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Tailwind CSS Pointer Media Query for Device Accuracy DESCRIPTION: This HTML snippet demonstrates using the `pointer-coarse` variant to apply specific styles (e.g., larger padding, different grid layout) when the primary pointing device is less accurate, such as a touchscreen. This helps in optimizing user experience for touch-based devices by providing larger interactive targets. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <fieldset aria-label="Choose a memory option"> <div class="flex items-center justify-between"> <div>RAM</div> <a href="#"> See performance specs </a> </div> <div class="mt-4 grid grid-cols-6 gap-2 pointer-coarse:mt-6 pointer-coarse:grid-cols-3 pointer-coarse:gap-4"> <label class="p-2 pointer-coarse:p-4 ..."> <input type="radio" name="memory-option" value="4 GB" className="sr-only" /> <span>4 GB</span> </label> <!-- ... --> </div> </fieldset> ``` ---------------------------------------- TITLE: Generated CSS for Tailwind Responsive Breakpoint DESCRIPTION: This CSS snippet illustrates how Tailwind CSS compiles a responsive utility like `sm:grid-cols-3`. It generates a media query (`@media (width >= 40rem)`) that applies the `grid-template-columns` style only when the screen width meets the specified breakpoint. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: CSS CODE: ``` .sm\:grid-cols-3 { @media (width >= 40rem) { grid-template-columns: repeat(3, minmax(0, 1fr)); }} ``` ---------------------------------------- TITLE: Apply Responsive Text Colors with Tailwind CSS DESCRIPTION: Shows how to apply different text colors based on screen size using Tailwind CSS's responsive variants. Prefixing a color utility with a breakpoint (e.g., `md:`) ensures the style is applied only at that breakpoint and above. SOURCE: https://tailwindcss.com/docs/color LANGUAGE: HTML CODE: ``` <p class="text-blue-600 md:text-green-600 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: TailwindCSS Touch-Action Utilities DESCRIPTION: Defines TailwindCSS utility classes for controlling how an element can be scrolled and zoomed on touchscreens. Each class maps directly to a specific CSS `touch-action` property value, allowing fine-grained control over touch interactions. SOURCE: https://tailwindcss.com/docs/touch-action LANGUAGE: APIDOC CODE: ``` touch-action: touch-auto: touch-action: auto; touch-none: touch-action: none; touch-pan-x: touch-action: pan-x; touch-pan-left: touch-action: pan-left; touch-pan-right: touch-action: pan-right; touch-pan-y: touch-action: pan-y; touch-pan-up: touch-action: pan-up; touch-pan-down: touch-action: pan-down; touch-pinch-zoom: touch-action: pinch-zoom; touch-manipulation: touch-action: manipulation; ``` ---------------------------------------- TITLE: Apply Responsive Padding with Tailwind CSS Breakpoints DESCRIPTION: Demonstrates how to apply padding utilities conditionally based on screen size using responsive breakpoint variants like `md:`. This allows for adaptive padding adjustments across different devices and viewports. SOURCE: https://tailwindcss.com/docs/padding LANGUAGE: HTML CODE: ``` <div class="py-4 md:py-8 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Layout Example: Stacked to Side-by-Side DESCRIPTION: Illustrates a responsive component that transitions from a stacked layout on small screens to a side-by-side (flex) layout on medium screens and above. It uses `md:flex` to change the display property, `md:shrink-0` to prevent image shrinking, and `md:h-full md:w-48` to adjust image dimensions responsively. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="mx-auto max-w-md overflow-hidden rounded-xl bg-white shadow-md md:max-w-2xl"> <div class="md:flex"> <div class="md:shrink-0"> <img class="h-48 w-full object-cover md:h-full md:w-48" src="/img/building.jpg" alt="Modern building architecture" /> </div> <div class="p-8"> <div class="text-sm font-semibold tracking-wide text-indigo-500 uppercase">Company retreats</div> <a href="#" class="mt-1 block text-lg leading-tight font-medium text-black hover:underline"> Incredible accommodation for your team </a> <p class="mt-2 text-gray-500"> Looking to take your team away on a retreat to enjoy awesome food and take in some sunshine? We have a list of places to do just that. </p> </div> </div></div> ``` ---------------------------------------- TITLE: Apply Responsive Justification with Tailwind CSS Breakpoint Variants DESCRIPTION: Demonstrates how to apply `justify-content` utilities conditionally based on screen size using Tailwind CSS responsive breakpoint variants. By prefixing a utility with `md:`, the justification will only apply at medium screen sizes and above, allowing for flexible layouts. SOURCE: https://tailwindcss.com/docs/justify-content LANGUAGE: HTML CODE: ``` <div class="flex justify-start md:justify-between ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive break-inside Utility in HTML DESCRIPTION: Illustrates how to apply the `break-inside` utility responsively using Tailwind CSS breakpoint variants. The `md:break-inside-auto` class ensures the utility is only applied at medium screen sizes and above, overriding default behavior. SOURCE: https://tailwindcss.com/docs/break-inside LANGUAGE: HTML CODE: ``` <div class="break-inside-avoid-column md:break-inside-auto ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Box Shadows with Tailwind CSS DESCRIPTION: Shows how to apply box shadow utilities conditionally based on screen size using responsive variants like `md:` in Tailwind CSS. SOURCE: https://tailwindcss.com/docs/box-shadow LANGUAGE: html CODE: ``` <div class="shadow-none md:shadow-lg ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Tailwind CSS Accent Color Responsively DESCRIPTION: Illustrates applying an accent color utility conditionally based on screen size using responsive variants like `md:`, changing the accent color at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/accent-color LANGUAGE: HTML CODE: ``` <input class="accent-black md:accent-pink-500 ..." type="checkbox" /> ``` ---------------------------------------- TITLE: Apply Responsive Text Color in Tailwind CSS DESCRIPTION: Shows how to apply different text colors based on screen sizes using responsive breakpoint variants like `md:` in Tailwind CSS, enabling adaptive design for various viewports. SOURCE: https://tailwindcss.com/docs/text-color LANGUAGE: HTML CODE: ``` <p class="text-blue-600 md:text-green-600 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply responsive background attachment with Tailwind CSS DESCRIPTION: This example demonstrates how to conditionally apply background attachment utilities based on screen size using responsive variants. The `md:bg-fixed` class ensures the background is fixed only on medium screens and above, while `bg-local` applies by default. SOURCE: https://tailwindcss.com/docs/background-attachment LANGUAGE: HTML CODE: ``` <div class="bg-local md:bg-fixed ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Height Utilities in Tailwind CSS DESCRIPTION: Shows how to use breakpoint variants like `md:` to apply height utilities conditionally based on screen sizes, enabling responsive design. SOURCE: https://tailwindcss.com/docs/height LANGUAGE: HTML CODE: ``` <div class="h-1/2 md:h-full ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Border Radius in HTML DESCRIPTION: Explains how to apply responsive border radius utilities using breakpoint variants, such as `md:rounded-lg`. This allows the border radius to change at different screen sizes, adapting the design for various devices. SOURCE: https://tailwindcss.com/docs/border-radius LANGUAGE: HTML CODE: ``` <div class="rounded md:rounded-lg ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: HTML List with Responsive Tailwind CSS list-style-position DESCRIPTION: An HTML snippet illustrating how to apply responsive `list-style-position` utilities using Tailwind CSS. The `md:list-inside` class ensures the list style changes at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/list-style-position LANGUAGE: HTML CODE: ``` <ul class="list-outside md:list-inside ..."> <!-- ... --></ul> ``` ---------------------------------------- TITLE: Apply Responsive Object Position in Tailwind CSS DESCRIPTION: Demonstrates how to make object positioning responsive by using breakpoint variants (e.g., `md:`) to apply different `object-position` utilities based on screen size. This allows for adaptive content positioning across various devices. SOURCE: https://tailwindcss.com/docs/object-position LANGUAGE: HTML CODE: ``` <img class="object-center md:object-top ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Scroll Margin in Tailwind CSS DESCRIPTION: Demonstrates how to use responsive variants like `md:` to conditionally apply scroll margin utilities based on screen size. This example sets a default `scroll-m-8` and overrides it to `scroll-m-0` at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/scroll-margin LANGUAGE: HTML CODE: ``` <div class="scroll-m-8 md:scroll-m-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Background Color with Tailwind CSS DESCRIPTION: Shows how to apply different background colors based on screen size using Tailwind CSS responsive variants like `md:`. This enables adaptive designs that change appearance across various devices and viewport sizes. SOURCE: https://tailwindcss.com/docs/background-color LANGUAGE: HTML CODE: ``` <div class="bg-blue-500 md:bg-green-500 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Font Family in Tailwind CSS DESCRIPTION: Demonstrates how to apply a font family utility conditionally based on screen size using Tailwind CSS's responsive variants. The `md:` prefix ensures the `font-serif` class is applied only at medium screen sizes and above, overriding the default `font-sans`. SOURCE: https://tailwindcss.com/docs/font-family LANGUAGE: HTML CODE: ``` <p class="font-sans md:font-serif ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Text Indentation with Tailwind CSS DESCRIPTION: Shows how to apply different text indentation values based on screen sizes using Tailwind CSS responsive variants. By prefixing utilities with breakpoint variants like `md:`, you can ensure adaptive layouts that adjust indentation for various device widths. SOURCE: https://tailwindcss.com/docs/text-indent LANGUAGE: HTML CODE: ``` <p class="indent-4 md:indent-8 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Implement Responsive Max Height in Tailwind CSS DESCRIPTION: Explains how to apply responsive maximum height utilities using breakpoint variants like `md:`. This allows the max height to change based on screen size, ensuring adaptive layouts that respond to different device widths. SOURCE: https://tailwindcss.com/docs/max-height LANGUAGE: HTML CODE: ``` <div class="h-48 max-h-full md:max-h-screen ..."> <!-- ... --> </div> ``` ---------------------------------------- TITLE: Apply Responsive Text Shadow in Tailwind CSS DESCRIPTION: Explains how to apply text shadow utilities conditionally based on screen size using responsive prefixes like `md:`. This allows for different shadow styles to be applied at various breakpoints, enhancing responsive design. SOURCE: https://tailwindcss.com/docs/text-shadow LANGUAGE: HTML CODE: ``` <p class="text-shadow-none md:text-shadow-lg ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Display Utilities with Tailwind CSS DESCRIPTION: Demonstrates how to apply display utilities conditionally based on screen size using responsive prefixes like `md:`. This allows for different display behaviors (e.g., `flex` vs. `inline-flex`) at various breakpoints, enabling adaptive and responsive design. SOURCE: https://tailwindcss.com/docs/display LANGUAGE: html CODE: ``` <div class="flex md:inline-flex ..."> <!-- ... --> </div> ``` ---------------------------------------- TITLE: Targeting a Single Breakpoint in Tailwind CSS DESCRIPTION: This example shows how to apply a utility class specifically for a single breakpoint. By combining a responsive variant (e.g., `md`) with the `max-*` variant of the *next* breakpoint (e.g., `max-lg`), the style is limited to the `md` breakpoint's range. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="md:max-lg:flex"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Vertical Alignment (Tailwind CSS) DESCRIPTION: Shows how to apply vertical alignment utilities conditionally based on screen size using responsive prefixes like `md:` in Tailwind CSS, allowing different alignments for different breakpoints. SOURCE: https://tailwindcss.com/docs/vertical-align LANGUAGE: html CODE: ``` <span class="align-middle md:align-top ..."> <!-- ... --></span> ``` ---------------------------------------- TITLE: Apply Responsive Translation with Tailwind CSS Variants DESCRIPTION: Shows how to make translation utilities responsive by prefixing them with breakpoint variants like `md:`. This applies the translation only at specified screen sizes and above, enabling adaptive layouts based on screen dimensions. SOURCE: https://tailwindcss.com/docs/translate LANGUAGE: HTML CODE: ``` <img class="translate-45 md:translate-60 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS backdrop-blur DESCRIPTION: Illustrates how to apply `backdrop-blur` utilities responsively using breakpoint variants like `md:`. This ensures the blur effect adapts to different screen sizes, allowing for `backdrop-blur-none` on small screens and `backdrop-blur-lg` on medium screens and above. SOURCE: https://tailwindcss.com/docs/backdrop-filter-blur LANGUAGE: HTML CODE: ``` <div class="backdrop-blur-none md:backdrop-blur-lg ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive break-before Utility in HTML DESCRIPTION: Illustrates how to apply `break-before` utilities responsively using Tailwind CSS breakpoint variants. This example sets `break-before-column` by default and overrides it with `break-before-auto` for medium screen sizes and above, allowing for flexible layout control across different devices. SOURCE: https://tailwindcss.com/docs/break-before LANGUAGE: HTML CODE: ``` <div class="break-before-column md:break-before-auto ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Touch Action Utilities in Tailwind CSS DESCRIPTION: This example demonstrates how to use various Tailwind CSS `touch-action` utilities like `touch-auto`, `touch-none`, `touch-pan-x`, and `touch-pan-y` to control touch-based scrolling and zooming behavior on elements. It shows different div containers, each configured with a specific touch action to illustrate their effects on an embedded image. SOURCE: https://tailwindcss.com/docs/touch-action LANGUAGE: HTML CODE: ``` <div class="h-48 w-full touch-auto overflow-auto ..."> <img class="h-auto w-[150%] max-w-none" src="..." /></div><div class="h-48 w-full touch-none overflow-auto ..."> <img class="h-auto w-[150%] max-w-none" src="..." /></div><div class="h-48 w-full touch-pan-x overflow-auto ..."> <img class="h-auto w-[150%] max-w-none" src="..." /></div><div class="h-48 w-full touch-pan-y overflow-auto ..."> <img class="h-auto w-[150%] max-w-none" src="..." /></div> ``` ---------------------------------------- TITLE: Responsive Grid Auto-Flow with Tailwind CSS DESCRIPTION: Illustrates applying responsive `grid-auto-flow` utilities using breakpoint variants like `md:` to change grid auto-placement behavior (e.g., from column to row flow) based on screen size, ensuring adaptability across devices. SOURCE: https://tailwindcss.com/docs/grid-auto-flow LANGUAGE: html CODE: ``` <div class="grid grid-flow-col md:grid-flow-row ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Numeric Font Variants with Tailwind CSS DESCRIPTION: Illustrates how to apply `font-variant-numeric` utilities conditionally based on screen size using responsive prefixes like `md:`, allowing for different numeric styling at various breakpoints in Tailwind CSS. SOURCE: https://tailwindcss.com/docs/font-variant-numeric LANGUAGE: html CODE: ``` <p class="proportional-nums md:tabular-nums ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Tailwind CSS User-Select Utilities Responsively DESCRIPTION: This snippet illustrates how to use Tailwind CSS breakpoint variants with `user-select` utilities. By prefixing `select-all` with `md:`, the text selection behavior changes from `select-none` to `select-all` only on medium screens and above, enabling responsive control over text selection. SOURCE: https://tailwindcss.com/docs/user-select LANGUAGE: HTML CODE: ``` <div class="select-none md:select-all ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive `outline-offset` DESCRIPTION: Illustrates how to apply `outline-offset` utilities conditionally based on screen size using responsive prefixes like `md:`, ensuring the outline offset adapts to different viewport dimensions. SOURCE: https://tailwindcss.com/docs/outline-offset LANGUAGE: html CODE: ``` <div class="outline md:outline-offset-2 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Implement Responsive Font Sizes with Tailwind CSS Breakpoints DESCRIPTION: This example demonstrates how to apply responsive font sizes using Tailwind CSS breakpoint variants. By prefixing a font size utility with `md:`, the utility will only apply at medium screen sizes and above, allowing for adaptive text sizing across different devices. SOURCE: https://tailwindcss.com/docs/font-size LANGUAGE: HTML CODE: ``` <p class="text-sm md:text-base ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Basic Container Query Usage in Tailwind CSS DESCRIPTION: This example illustrates the fundamental use of container queries in Tailwind CSS. By marking a parent element with `@container`, child elements can be styled based on the parent's size using variants like `@md`, enabling more portable and reusable components. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-col @md:flex-row"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Tailwind CSS background-clip Responsive Design Example DESCRIPTION: Shows how to apply `background-clip` utilities conditionally based on screen size using responsive variants like `md:`. This allows for different background clipping behaviors to be applied at various breakpoints, adapting to responsive layouts. SOURCE: https://tailwindcss.com/docs/background-clip LANGUAGE: html CODE: ``` <div class="bg-clip-border md:bg-clip-padding ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS: Responsive List Styles DESCRIPTION: Shows how to apply list style utilities conditionally based on screen size using responsive prefixes. For example, `md:list-disc` applies a disc marker only at medium screen sizes and above, while `list-none` removes markers by default. SOURCE: https://tailwindcss.com/docs/list-style-type LANGUAGE: HTML CODE: ``` <ul class="list-none md:list-disc ..."> <!-- ... --></ul> ``` ---------------------------------------- TITLE: Apply Responsive Background Size with Tailwind CSS DESCRIPTION: This snippet demonstrates how to use Tailwind CSS utility classes to control background size responsively. The `bg-auto` class applies `background-size: auto` by default, while `md:bg-contain` overrides this to `background-size: contain` specifically for medium screen sizes and above. This allows for different background behaviors across various device viewports. SOURCE: https://tailwindcss.com/docs/background-size LANGUAGE: HTML CODE: ``` <div class="bg-auto md:bg-contain ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Scroll Snap Stop Behavior with Tailwind CSS DESCRIPTION: This HTML snippet shows how to apply scroll snap stop utilities conditionally based on screen size using Tailwind CSS responsive variants. The `md:snap-normal` class ensures that `snap-normal` behavior is only active on medium screens and above, while `snap-always` applies by default on smaller screens. This allows for adaptive scroll behavior across different device sizes. SOURCE: https://tailwindcss.com/docs/scroll-snap-stop LANGUAGE: HTML CODE: ``` <div class="snap-always md:snap-normal ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Contrast Filter in HTML with Tailwind CSS DESCRIPTION: This HTML snippet illustrates the use of Tailwind CSS utility classes for responsive design. The `contrast-125` class sets a base contrast, and the `md:contrast-150` class applies a different contrast value specifically for medium screens and larger, showcasing how breakpoint variants (`md:`) modify styles conditionally. SOURCE: https://tailwindcss.com/docs/filter-contrast LANGUAGE: html CODE: ``` <img class="contrast-125 md:contrast-150 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Text Decoration Color with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply responsive text decoration colors using Tailwind CSS. It uses the `md:` breakpoint variant to change the `text-decoration-color` from `sky-600` to `blue-400` at medium screen sizes and above, showcasing how utilities can be conditionally applied based on screen dimensions. SOURCE: https://tailwindcss.com/docs/text-decoration-color LANGUAGE: HTML CODE: ``` <p class="underline decoration-sky-600 md:decoration-blue-400 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Hue Rotation with Tailwind CSS DESCRIPTION: Demonstrates how to apply responsive hue rotation by prefixing the `hue-rotate` utility with a breakpoint variant (e.g., `md:`). This allows for different hue rotation values based on screen size. SOURCE: https://tailwindcss.com/docs/filter-hue-rotate LANGUAGE: HTML CODE: ``` <img class="hue-rotate-60 md:hue-rotate-0 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Web API: window.matchMedia() and localStorage DESCRIPTION: This API documentation describes the `window.matchMedia()` method for querying media features and `localStorage` for client-side data persistence, both crucial for implementing dynamic theme switching based on user preference and system settings. SOURCE: https://tailwindcss.com/docs/dark-mode LANGUAGE: APIDOC CODE: ``` window.matchMedia(mediaQueryString) - Description: Returns a new `MediaQueryList` object that can be used to determine if the document matches the passed media query string, as well as to monitor the document to see when it changes to match (or unmatch) the media query. - Parameters: - `mediaQueryString`: (string) A string representing the media query to parse. - Returns: `MediaQueryList` object. - Example Usage: `window.matchMedia("(prefers-color-scheme: dark)").matches` - Checks if the user's system prefers a dark color scheme. localStorage - Description: A read-only property that allows you to access a `Storage` object for the `Document`'s origin; the stored data is saved across browser sessions. - Methods: - `localStorage.setItem(key, value)`: Adds or updates a key-value pair. - `key`: (string) The name of the key. - `value`: (string) The value to store. - `localStorage.getItem(key)`: Retrieves the value associated with a key. - `key`: (string) The name of the key. - Returns: (string | null) The value if found, otherwise `null`. - `localStorage.removeItem(key)`: Removes a key-value pair. - `key`: (string) The name of the key to remove. - Example Usage: `localStorage.theme = "dark";` `localStorage.getItem("theme");` `localStorage.removeItem("theme");` ``` ---------------------------------------- TITLE: Apply Responsive Border Widths in Tailwind CSS DESCRIPTION: Shows how to use responsive variants like `md:` to apply border width utilities conditionally based on screen size. This allows for different border styles or widths at various breakpoints, such as `md:border-t-4`. SOURCE: https://tailwindcss.com/docs/border-width LANGUAGE: HTML CODE: ``` <div class="border-2 md:border-t-4 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Minimum Widths with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to make minimum width utilities responsive using breakpoint variants like `md:`. This allows the `min-width` property to change based on screen size, enabling adaptive layouts. SOURCE: https://tailwindcss.com/docs/min-width LANGUAGE: HTML CODE: ``` <div class="w-24 min-w-full md:min-w-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Text Decoration Style with Tailwind CSS DESCRIPTION: Illustrates how to apply a text decoration style conditionally based on screen size using Tailwind CSS responsive variants. The `md:` prefix ensures the `decoration-dashed` style is applied only at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/text-decoration-style LANGUAGE: HTML CODE: ``` <p class="underline md:decoration-dashed ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Responsive Tailwind CSS grid-auto-columns with Breakpoints DESCRIPTION: Shows how to apply `grid-auto-columns` utilities responsively using Tailwind CSS breakpoint variants. This example demonstrates changing the implicit column sizing from `max-content` to `min-content` at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/grid-auto-columns LANGUAGE: HTML CODE: ``` <div class="grid grid-flow-col auto-cols-max md:auto-cols-min ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Targeting a Specific Breakpoint Range in Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply a utility class only within a specific breakpoint range by stacking a responsive variant (e.g., `md`) with a `max-*` variant (e.g., `max-xl`). This ensures the style is active only when the breakpoint range is met. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="md:max-xl:flex"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Place Content Utilities (Tailwind CSS) DESCRIPTION: Demonstrates how to use responsive variants like `md:` with `place-content` utilities to apply different content distribution rules based on screen size in Tailwind CSS. SOURCE: https://tailwindcss.com/docs/place-content LANGUAGE: html CODE: ``` <div class="grid place-content-start md:place-content-center ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive List Marker Image with Tailwind CSS DESCRIPTION: Demonstrates how to apply the `list-style-image` utility responsively using breakpoint variants like `md:` in Tailwind CSS. SOURCE: https://tailwindcss.com/docs/list-style-image LANGUAGE: html CODE: ``` <div class="list-image-none md:list-image-[url(/img/checkmark.png)] ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Profile Card with Hover States DESCRIPTION: This HTML example illustrates a more advanced profile card component built with Tailwind CSS, demonstrating responsive design and interactive states. It uses responsive prefixes like `sm:flex-row` for layout changes on small screens and state variants like `hover:bg-purple-600` and `active:bg-purple-700` for button styling, showcasing how complex UIs can be constructed purely with utility classes. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div class="flex flex-col gap-2 p-8 sm:flex-row sm:items-center sm:gap-6 sm:py-4 ..."> <img class="mx-auto block h-24 rounded-full sm:mx-0 sm:shrink-0" src="/img/erin-lindford.jpg" alt="" /> <div class="space-y-2 text-center sm:text-left"> <div class="space-y-0.5"> <p class="text-lg font-semibold text-black">Erin Lindford</p> <p class="font-medium text-gray-500">Product Engineer</p> </div> <button class="border-purple-200 text-purple-600 hover:border-transparent hover:bg-purple-600 hover:text-white active:bg-purple-700 ..."> Message </button> </div></div> ``` ---------------------------------------- TITLE: Implement Responsive Scroll Snapping in Tailwind CSS DESCRIPTION: This HTML snippet illustrates how to apply Tailwind CSS scroll snapping utilities responsively using breakpoint variants. By using `md:snap-x`, horizontal snapping is enabled only on medium screen sizes and above, while `snap-none` ensures no snapping occurs by default on smaller screens. This allows for adaptive scroll behavior based on the viewport size. SOURCE: https://tailwindcss.com/docs/scroll-snap-type LANGUAGE: HTML CODE: ``` <div class="snap-none md:snap-x ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Implement responsive flex basis with Tailwind CSS breakpoints DESCRIPTION: This HTML example demonstrates how to apply responsive `flex-basis` utilities using breakpoint variants like `md:`. This allows the initial size of flex items to change based on screen size, ensuring adaptive layouts for different devices. SOURCE: https://tailwindcss.com/docs/flex-basis LANGUAGE: html CODE: ``` <div class="flex flex-row"> <div class="basis-1/4 md:basis-1/3">01</div> <div class="basis-1/4 md:basis-1/3">02</div> <div class="basis-1/2 md:basis-1/3">03</div></div> ``` ---------------------------------------- TITLE: Apply Responsive Border Colors in Tailwind CSS DESCRIPTION: Shows how to apply border color utilities conditionally based on screen size using responsive prefixes like `md:`. SOURCE: https://tailwindcss.com/docs/border-color LANGUAGE: HTML CODE: ``` <div class="border-blue-500 md:border-green-500 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: HTML Example for Responsive Tailwind CSS transition-behavior DESCRIPTION: Illustrates how to apply responsive `transition-behavior` utilities using breakpoint variants like `md:`. This allows developers to conditionally control transition behavior based on different screen sizes, applying `transition-normal` from medium screens and up. SOURCE: https://tailwindcss.com/docs/transition-behavior LANGUAGE: HTML CODE: ``` <button class="transition-discrete md:transition-normal ..."> <!-- ... --></button> ``` ---------------------------------------- TITLE: Responsive Caret Color with Tailwind CSS DESCRIPTION: Shows how to apply different caret colors based on screen size using Tailwind CSS responsive variants. By prefixing a `caret-color` utility with a breakpoint variant (e.g., `md:`), the utility only applies at that screen size and above. SOURCE: https://tailwindcss.com/docs/caret-color LANGUAGE: HTML CODE: ``` <textarea class="caret-rose-500 md:caret-lime-600 ..."></textarea> ``` ---------------------------------------- TITLE: Apply Responsive Stroke Width with Breakpoints DESCRIPTION: Demonstrates how to apply different stroke width utilities based on screen size using responsive design prefixes like `md:`, allowing `stroke-1` by default and `md:stroke-2` for medium screens and above. SOURCE: https://tailwindcss.com/docs/stroke-width LANGUAGE: HTML CODE: ``` <div class="stroke-1 md:stroke-2 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Implement Responsive Skew with Tailwind CSS Breakpoints DESCRIPTION: Demonstrates how to apply skew utilities conditionally based on screen size using Tailwind CSS's responsive design prefixes. By adding a breakpoint variant like `md:`, the `skew-12` utility will only apply at medium screen sizes and above, while `skew-3` applies by default, allowing for adaptive designs. SOURCE: https://tailwindcss.com/docs/skew LANGUAGE: html CODE: ``` <img class="skew-3 md:skew-12 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS Isolation Utilities DESCRIPTION: Illustrates how to use responsive variants in Tailwind CSS to apply different `isolation` utilities based on screen size, specifically applying `isolation-auto` from medium screen sizes and up. SOURCE: https://tailwindcss.com/docs/isolation LANGUAGE: HTML CODE: ``` <div class="isolate md:isolation-auto ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Box Decoration Break Utilities with Tailwind CSS DESCRIPTION: Illustrates how to apply `box-decoration-break` utilities conditionally based on screen size using responsive prefixes like `md:` in Tailwind CSS, allowing different rendering behaviors for different breakpoints. SOURCE: https://tailwindcss.com/docs/box-decoration-break LANGUAGE: HTML CODE: ``` <div class="box-decoration-clone md:box-decoration-slice ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Forced Color Adjustments with Tailwind CSS DESCRIPTION: This HTML snippet illustrates how to apply `forced-color-adjust` utilities responsively using Tailwind CSS breakpoint variants. The `md:forced-color-adjust-auto` class ensures that the element adheres to forced colors only on medium screens and above, while `forced-color-adjust-none` applies by default, allowing for flexible styling based on screen size. SOURCE: https://tailwindcss.com/docs/forced-color-adjust LANGUAGE: html CODE: ``` <div class="forced-color-adjust-none md:forced-color-adjust-auto ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Backdrop Inversion with Tailwind CSS DESCRIPTION: Illustrates how to apply a backdrop inversion filter responsively using Tailwind CSS breakpoint variants. By prefixing the utility with `md:`, the `backdrop-invert` utility will only be applied at medium screen sizes and above, allowing for adaptive designs. SOURCE: https://tailwindcss.com/docs/backdrop-filter-invert LANGUAGE: HTML CODE: ``` <div class="backdrop-invert-0 md:backdrop-invert ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Named Container Queries in Tailwind CSS HTML DESCRIPTION: Demonstrates how to define and target named container queries in HTML using Tailwind CSS. This allows styling elements based on the size of a specific, potentially distant, parent container, improving organization in complex layouts. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container/main"> <!-- ... --> <div class="flex flex-row @sm/main:flex-col"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Resolving bare values for functional utilities DESCRIPTION: Demonstrates how to resolve functional utility values as bare, un-themed values by specifying a data type (e.g., `integer`) within the `--value({type})` syntax. This allows for direct numeric or other type-specific inputs for utilities. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: CSS CODE: ``` @utility tab-* { tab-size: --value(integer);} ``` ---------------------------------------- TITLE: Apply responsive Tailwind CSS `resize` utilities DESCRIPTION: Illustrates how to use responsive variants like `md:resize` to apply `resize` utilities conditionally based on screen size, allowing for different resizing behaviors across breakpoints. SOURCE: https://tailwindcss.com/docs/resize LANGUAGE: HTML CODE: ``` <div class="resize-none md:resize ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Implement Ping Animation for Notification Badges DESCRIPTION: Illustrates the application of the `animate-ping` utility to create a scaling and fading effect, similar to a radar ping or water ripple. This animation is particularly useful for drawing attention to elements like notification badges. SOURCE: https://tailwindcss.com/docs/animation LANGUAGE: HTML CODE: ``` <span class="relative flex size-3"> <span class="absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"></span> <span class="relative inline-flex size-3 rounded-full bg-sky-500"></span></span> ``` ---------------------------------------- TITLE: Tailwind CSS Default Responsive Breakpoints DESCRIPTION: This section outlines the default responsive breakpoints provided by Tailwind CSS. Each breakpoint has a specific prefix, a minimum width in `rem` and `px`, and the corresponding CSS media query that defines its range. These breakpoints are used to apply conditional styles. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: APIDOC CODE: ``` Breakpoint prefix | Minimum width | CSS --- | --- | --- `sm` | 40rem *(640px)* | `@media (width >= 40rem) { ... }` `md` | 48rem *(768px)* | `@media (width >= 48rem) { ... }` `lg` | 64rem *(1024px)* | `@media (width >= 64rem) { ... }` `xl` | 80rem *(1280px)* | `@media (width >= 80rem) { ... }` `2xl` | 96rem *(1536px)* | `@media (width >= 96rem) { ... }` ``` ---------------------------------------- TITLE: Applying Responsive `overflow-wrap` Utilities in Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply `overflow-wrap` utilities responsively using Tailwind CSS breakpoint variants. By prefixing `wrap-break-word` with `md:`, the utility will only take effect at medium screen sizes and above, allowing for adaptive text wrapping behavior across different device widths. SOURCE: https://tailwindcss.com/docs/overflow-wrap LANGUAGE: HTML CODE: ``` <p class="wrap-normal md:wrap-break-word ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Responsive text wrapping with Tailwind CSS DESCRIPTION: Shows how to apply text wrapping utilities responsively using Tailwind CSS breakpoint variants. By prefixing a `text-wrap` utility with a breakpoint like `md:`, the utility will only apply at that screen size and above, allowing for adaptive text layouts. SOURCE: https://tailwindcss.com/docs/text-wrap LANGUAGE: HTML CODE: ``` <h1 class="text-pretty md:text-balance ..."> <!-- ... --></h1> ``` ---------------------------------------- TITLE: Apply Responsive Saturation Filter with Tailwind CSS DESCRIPTION: Demonstrates how to use Tailwind CSS's `saturate()` utility with responsive variants like `md:` to apply different filter values based on screen size. This allows for dynamic visual adjustments of images, making them appear differently on medium screens and above compared to smaller screens. SOURCE: https://tailwindcss.com/docs/filter-saturate LANGUAGE: HTML CODE: ``` <img class="saturate-50 md:saturate-150 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply responsive text decoration thickness with Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply a responsive text decoration thickness using Tailwind CSS. By prefixing the `decoration-4` utility with `md:`, the thickness is only applied at medium screen sizes and above, showcasing Tailwind's utility-first approach for responsive design. SOURCE: https://tailwindcss.com/docs/text-decoration-thickness LANGUAGE: HTML CODE: ``` <p class="underline md:decoration-4 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive `align-content` Utilities in Tailwind CSS DESCRIPTION: Demonstrates how to apply `align-content` utilities conditionally based on screen size using responsive prefixes like `md:`. This allows for different content alignment behaviors across various breakpoints, enabling adaptive grid layouts. SOURCE: https://tailwindcss.com/docs/align-content LANGUAGE: HTML CODE: ``` <div class="grid content-start md:content-around ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: React Component for Vacation Card DESCRIPTION: Illustrates how to create a reusable React component (`VacationCard`) that encapsulates structure and styles. This approach promotes a single source of truth for styles, making updates easier across multiple instances. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: JavaScript CODE: ``` export function VacationCard({ img, imgAlt, eyebrow, title, pricing, url }) { return ( <div> <img className="rounded-lg" src={img} alt={imgAlt} /> <div className="mt-4"> <div className="text-xs font-bold text-sky-500">{eyebrow}</div> <div className="mt-1 font-bold text-gray-700"> <a href={url} className="hover:underline"> {title} </a> </div> <div className="mt-2 text-sm text-gray-600">{pricing}</div> </div> </div> );} ``` ---------------------------------------- TITLE: Apply Responsive CSS Clears with Tailwind CSS DESCRIPTION: Illustrates how to conditionally apply or remove CSS `clear` properties based on screen size using Tailwind CSS responsive variants. The `md:clear-none` utility disables clearing for medium screens and above, while `clear-left` applies a left clear on smaller screens, allowing for flexible layout adjustments. SOURCE: https://tailwindcss.com/docs/clear LANGUAGE: html CODE: ``` <p class="clear-left md:clear-none ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Background Position with Tailwind CSS Breakpoints DESCRIPTION: This example shows how to make background position responsive by prefixing utilities with breakpoint variants like `md:`. This ensures that background positioning adapts to different screen sizes, providing an optimal layout across various devices and viewports. SOURCE: https://tailwindcss.com/docs/background-position LANGUAGE: HTML CODE: ``` <div class="bg-center md:bg-top ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Dynamic Contributors List with Templating Loop DESCRIPTION: This snippet demonstrates how to dynamically render a list of contributors using a templating loop (e.g., Svelte, Nunjucks, or similar syntax). Instead of hardcoding each contributor's image, it iterates over a 'contributors' data array, rendering an `<img>` tag for each user. This approach significantly reduces code duplication, making the UI scalable and easier to maintain as the list of contributors changes. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div> <div class="flex items-center space-x-2 text-base"> <h4 class="font-semibold text-slate-900">Contributors</h4> <span class="bg-slate-100 px-2 py-1 text-xs font-semibold text-slate-700 ...">204</span> </div> <div class="mt-3 flex -space-x-2 overflow-hidden"> {#each contributors as user} <img class="inline-block h-12 w-12 rounded-full ring-2 ring-white" src={user.avatarUrl} alt={user.handle} /> {/each} </div> <div class="mt-3 text-sm font-medium"> <a href="#" class="text-blue-500">+ 198 others</a> </div></div> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Flex Direction Example DESCRIPTION: Demonstrates how to apply `flex-direction` utilities responsively using breakpoint variants. The example shows changing from a column layout to a row layout at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/flex-direction LANGUAGE: HTML CODE: ``` <div class="flex flex-col md:flex-row ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply responsive text decoration with Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply text decoration utilities responsively in Tailwind CSS. By prefixing a utility like `underline` with a breakpoint variant (e.g., `md:`), the styling is only applied at that screen size and above. This allows for adaptive designs where text decoration changes based on the viewport. SOURCE: https://tailwindcss.com/docs/text-decoration-line LANGUAGE: HTML CODE: ``` <a class="no-underline md:underline ..." href="..."> <!-- ... --></a> ``` ---------------------------------------- TITLE: Tailwind CSS Responsive Grid Row Spanning DESCRIPTION: Demonstrates how to apply responsive design principles to Tailwind CSS grid row utilities using breakpoint variants. This example shows how `md:row-span-4` can change an element's row span at medium screen sizes and above, allowing for adaptive layouts. SOURCE: https://tailwindcss.com/docs/grid-row LANGUAGE: HTML CODE: ``` <div class="row-span-3 md:row-span-4 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Widths with Tailwind CSS Breakpoints DESCRIPTION: Demonstrates how to apply different width utility classes based on screen size using Tailwind's `md:` and `lg:` prefixes. The element will have a width of `w-16` by default, `w-32` on medium screens (768px and up), and `w-48` on large screens (1024px and up). SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <!-- Width of 16 by default, 32 on medium screens, and 48 on large screens --><img class="w-16 md:w-32 lg:w-48" src="..." /> ``` ---------------------------------------- TITLE: Tailwind CSS: Apply Responsive Flex Wrap Utilities DESCRIPTION: Demonstrates how to use responsive variants like `md:flex-wrap-reverse` to apply flex wrapping behavior only at specific screen sizes and above. This allows for different layouts based on viewport width. SOURCE: https://tailwindcss.com/docs/flex-wrap LANGUAGE: HTML CODE: ``` <div class="flex flex-wrap md:flex-wrap-reverse ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Underline Offset in HTML with Tailwind CSS DESCRIPTION: This HTML snippet illustrates how to use Tailwind CSS's responsive utilities to apply an `underline-offset` only at medium screen sizes and above. The `md:` prefix ensures the `underline-offset-4` class takes effect from the medium breakpoint, providing a different underline position for larger screens. SOURCE: https://tailwindcss.com/docs/text-underline-offset LANGUAGE: HTML CODE: ``` <p class="underline md:underline-offset-4 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Overflow Behavior with Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply responsive overflow behavior using Tailwind CSS breakpoint variants. By prefixing an overflow utility with a breakpoint like `md:`, the utility will only be applied at that screen size and above, allowing for adaptive scrolling based on device width. SOURCE: https://tailwindcss.com/docs/overflow LANGUAGE: HTML CODE: ``` <div class="overflow-auto md:overflow-scroll ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Appearance Utility with Tailwind CSS DESCRIPTION: Demonstrates how to use Tailwind CSS responsive variants, specifically `md:appearance-none`, to control the appearance of an HTML element (like a select box) at different screen sizes. The `appearance-auto` class applies the default appearance, while `md:appearance-none` removes it from medium screens and up. SOURCE: https://tailwindcss.com/docs/appearance LANGUAGE: html CODE: ``` <select class="appearance-auto md:appearance-none ..."> <!-- ... --></select> ``` ---------------------------------------- TITLE: Apply Responsive box-sizing Utilities in HTML DESCRIPTION: Shows how to apply `box-sizing` utilities conditionally based on screen size using Tailwind CSS responsive prefixes. This example sets `box-content` by default and switches to `box-border` for medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/box-sizing LANGUAGE: HTML CODE: ``` <div class="box-content md:box-border ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive z-index with Breakpoint Variants DESCRIPTION: Demonstrates how to apply z-index utilities conditionally based on screen size using responsive breakpoint variants, such as `md:z-50`, ensuring the utility only applies at medium screen sizes and above. SOURCE: https://tailwindcss.com/docs/z-index LANGUAGE: html CODE: ``` <div class="z-0 md:z-50 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Implement Responsive Table Layouts with Tailwind CSS DESCRIPTION: This HTML snippet illustrates how to apply responsive table layout utilities using Tailwind CSS. By using a breakpoint variant like `md:table-fixed`, the fixed table layout is applied only at medium screen sizes and above, while `table-auto` serves as the default layout for smaller screens. SOURCE: https://tailwindcss.com/docs/table-layout LANGUAGE: html CODE: ``` <div class="table-auto md:table-fixed ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Scroll Padding in Tailwind CSS DESCRIPTION: Shows how to apply responsive scroll padding utilities (e.g., `md:scroll-p-0`) in Tailwind CSS. This enables different padding values to be applied based on screen size breakpoints, ensuring optimal layout across various devices. SOURCE: https://tailwindcss.com/docs/scroll-padding LANGUAGE: HTML CODE: ``` <div class="scroll-p-8 md:scroll-p-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Transform Origin in Tailwind CSS DESCRIPTION: Demonstrates how to make transform origin utilities responsive in Tailwind CSS by prefixing them with breakpoint variants like `md:`. This ensures the utility is only applied at the specified screen size and above, allowing for adaptive designs that adjust based on device characteristics. SOURCE: https://tailwindcss.com/docs/transform-origin LANGUAGE: HTML CODE: ``` <img class="origin-center md:origin-top ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Positioning with Tailwind CSS DESCRIPTION: Illustrates how to make positioning utilities responsive in Tailwind CSS by using breakpoint prefixes. This example shows how an element can be `relative` by default and become `absolute` on medium screens and larger, allowing for adaptive layouts based on screen size. SOURCE: https://tailwindcss.com/docs/position LANGUAGE: html CODE: ``` <div class="relative md:absolute ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply responsive align-self utilities in Tailwind CSS DESCRIPTION: Demonstrates how to apply `align-self` utilities responsively using breakpoint variants like `md:`. This allows for different alignment behaviors based on screen size, such as `self-auto` by default and `self-end` on medium screens and above. SOURCE: https://tailwindcss.com/docs/align-self LANGUAGE: html CODE: ``` <div class="self-auto md:self-end ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Max-Width with Tailwind CSS DESCRIPTION: Demonstrates how to use Tailwind CSS breakpoint variants (e.g., `md:`) to apply `max-width` utilities conditionally based on screen size. This allows for different maximum widths at various responsive breakpoints. SOURCE: https://tailwindcss.com/docs/max-width LANGUAGE: HTML CODE: ``` <div class="max-w-sm md:max-w-lg ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Utilize Container Query Length Units in Tailwind CSS HTML DESCRIPTION: Shows how to use container query length units like `cqw` (container query width) as arbitrary values in Tailwind CSS utility classes. This allows sizing elements relative to their parent container's dimensions, providing more flexible and responsive layouts. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="w-[50cqw]"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Tailwind CSS Arbitrary Peer Variants with Selector Control using '&' DESCRIPTION: This snippet demonstrates advanced control over arbitrary peer variants by using the `&` character. The `&` marks where the `.peer` class should be placed in the final generated CSS selector, allowing for more complex and specific targeting, such as `peer-[:nth-of-type(3)_&]:block`. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div> <input type="text" class="peer" /> <div class="hidden peer-[:nth-of-type(3)_&]:block"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Applying Container Queries with Tailwind CSS `@container` Variant DESCRIPTION: This example demonstrates the use of Tailwind CSS's container query variants (`@md`, `@lg`) to style elements based on the width of their parent container, rather than the viewport. The `@container` class enables the parent to become a query container, allowing child elements to adapt their layout. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-col @md:flex-row"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Apply Responsive Column Layouts in Tailwind CSS DESCRIPTION: Explains how to make column layouts responsive using Tailwind CSS breakpoint variants. By prefixing utilities like `sm:columns-3` and `sm:gap-8`, different column configurations and gaps can be applied based on screen sizes, ensuring adaptability across various devices. SOURCE: https://tailwindcss.com/docs/columns LANGUAGE: HTML CODE: ``` <div class="columns-2 gap-4 sm:columns-3 sm:gap-8 ..."> <img class="aspect-3/2 ..." src="/img/mountains-1.jpg" /> <img class="aspect-square ..." src="/img/mountains-2.jpg" /> <img class="aspect-square ..." src="/img/mountains-3.jpg" /> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Text Alignment with Tailwind CSS DESCRIPTION: Illustrates how to apply responsive text alignment using Tailwind CSS utility classes. By prefixing `text-align` utilities with breakpoint variants like `md:`, the alignment is applied only at specified screen sizes and above, allowing for adaptive layouts based on screen dimensions. SOURCE: https://tailwindcss.com/docs/text-align LANGUAGE: HTML CODE: ``` <p class="text-left md:text-center ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Outline Width with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply a responsive outline width using Tailwind CSS. The `md:outline-2` class ensures that the outline width is `2` at medium screen sizes and above, while `outline` applies a default outline. This utilizes Tailwind's responsive utility classes for conditional styling based on screen size. SOURCE: https://tailwindcss.com/docs/outline-width LANGUAGE: HTML CODE: ``` <div class="outline md:outline-2 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Mask Position with Breakpoints in Tailwind CSS DESCRIPTION: Demonstrates how to make mask positions responsive using Tailwind CSS breakpoint variants. By prefixing a utility (e.g., `md:mask-top`), the mask position can be conditionally applied based on screen size, allowing for different layouts across devices. SOURCE: https://tailwindcss.com/docs/mask-position LANGUAGE: HTML CODE: ``` <div class="mask-center md:mask-top ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Mask Utilities in HTML DESCRIPTION: Shows how to make mask utilities responsive by prefixing them with breakpoint variants like `md:`. This allows the mask properties, such as `mask-radial-from-<value>`, to change based on screen size, enabling adaptive designs. SOURCE: https://tailwindcss.com/docs/mask-image LANGUAGE: HTML CODE: ``` <div class="mask-radial-from-70% md:mask-radial-from-50% ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Drop Shadows in Tailwind CSS DESCRIPTION: Explains how to apply drop shadow utilities conditionally based on screen size using responsive design prefixes like `md:`, allowing different shadow sizes for various breakpoints. SOURCE: https://tailwindcss.com/docs/filter-drop-shadow LANGUAGE: HTML CODE: ``` <svg class="drop-shadow-md md:drop-shadow-xl ..."> <!-- ... --></svg> ``` ---------------------------------------- TITLE: Responsive Visibility with Tailwind CSS Breakpoints DESCRIPTION: Shows how to apply responsive visibility using Tailwind CSS breakpoint variants. The `md:invisible` class makes an element invisible only from medium screen sizes and up, while remaining visible on smaller screens, providing fine-grained control over responsiveness. SOURCE: https://tailwindcss.com/docs/visibility LANGUAGE: HTML CODE: ``` <div class="visible md:invisible ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive transform-style in Tailwind CSS DESCRIPTION: Illustrates how to apply `transform-style` utilities conditionally based on screen size using Tailwind CSS's responsive prefixes. This example shows an element that is `transform-3d` by default and becomes `transform-flat` on medium screens and above. SOURCE: https://tailwindcss.com/docs/transform-style LANGUAGE: HTML CODE: ``` <div class="transform-3d md:transform-flat ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Tailwind CSS backdrop-sepia responsively DESCRIPTION: This HTML snippet shows how to apply a `backdrop-sepia` filter conditionally based on screen size using Tailwind CSS responsive prefixes. The `md:backdrop-sepia-0` class ensures that the sepia filter is removed (set to 0) on medium screens and above, while `backdrop-sepia` applies a default sepia filter on smaller screens. SOURCE: https://tailwindcss.com/docs/backdrop-filter-sepia LANGUAGE: HTML CODE: ``` <div class="backdrop-sepia md:backdrop-sepia-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS v4 Hover Variant Behavior and Override DESCRIPTION: In Tailwind CSS v4, the `hover` variant now applies only when the primary input device supports hover. This snippet shows the default v4 behavior and how to override it with a custom variant to restore the old implementation, which might be necessary for touch devices that relied on tap-to-hover. SOURCE: https://tailwindcss.com/docs/upgrade-guide LANGUAGE: CSS CODE: ``` @media (hover: hover) { .hover\:underline:hover { text-decoration: underline; }} ``` LANGUAGE: CSS CODE: ``` @custom-variant hover (&:hover); ``` ---------------------------------------- TITLE: Apply Responsive Order Utility in Tailwind CSS DESCRIPTION: Demonstrates how to use Tailwind CSS's `order` utility with responsive prefixes (e.g., `md:`) to change the visual order of elements based on screen size. The `order-first` class applies by default, while `md:order-last` overrides it for medium screens and above, allowing for flexible layout adjustments. SOURCE: https://tailwindcss.com/docs/order LANGUAGE: HTML CODE: ``` <div class="order-first md:order-last ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: HTML Example: Responsive Tailwind CSS transition-delay DESCRIPTION: Demonstrates applying responsive `transition-delay` utilities using breakpoint variants like `md:` to change the delay based on screen size. SOURCE: https://tailwindcss.com/docs/transition-delay LANGUAGE: HTML CODE: ``` <button class="delay-150 md:delay-300 ..."> <!-- ... --></button> ``` ---------------------------------------- TITLE: Apply Responsive Outline Style with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply a dashed outline style only on medium screen sizes and above using Tailwind CSS's responsive `md:` variant prefix. The `outline` class provides a default outline, which is then overridden responsively to `outline-dashed` for larger viewports. SOURCE: https://tailwindcss.com/docs/outline-style LANGUAGE: HTML CODE: ``` <div class="outline md:outline-dashed ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Select All Text on Click with Tailwind CSS DESCRIPTION: Shows how to configure an HTML element so that all its text content is automatically selected when a user clicks on it, using the `select-all` utility class in Tailwind CSS. This provides a convenient way for users to copy content. SOURCE: https://tailwindcss.com/docs/user-select LANGUAGE: HTML CODE: ``` <div class="select-all ...">The quick brown fox jumps over the lazy dog.</div> ``` ---------------------------------------- TITLE: HTML Example: Responsive Field Sizing with Tailwind CSS DESCRIPTION: Shows how to implement responsive design for form control sizing using Tailwind CSS variants. The `field-sizing-content` class is applied by default, while `md:field-sizing-fixed` overrides it to apply fixed sizing only on medium screen sizes and above, adapting the input's behavior to different viewports. SOURCE: https://tailwindcss.com/docs/field-sizing LANGUAGE: HTML CODE: ``` <input class="field-sizing-content md:field-sizing-fixed ..." /> ``` ---------------------------------------- TITLE: Use Auto Select Behavior with Tailwind CSS DESCRIPTION: Explains how to revert to the default browser behavior for text selection within an HTML element using the `select-auto` utility class in Tailwind CSS. This ensures that the browser's native text selection rules apply. SOURCE: https://tailwindcss.com/docs/user-select LANGUAGE: HTML CODE: ``` <div class="select-auto ...">The quick brown fox jumps over the lazy dog.</div> ``` ---------------------------------------- TITLE: Apply Responsive Stroke Colors with Tailwind CSS DESCRIPTION: Explains how to use responsive prefixes like `md:` to apply different stroke colors based on screen size in Tailwind CSS. This enables adaptive styling where an SVG's stroke color can change at specific breakpoints. SOURCE: https://tailwindcss.com/docs/stroke LANGUAGE: HTML CODE: ``` <svg class="stroke-cyan-500 md:stroke-cyan-700 ..."> <!-- ... --></svg> ``` ---------------------------------------- TITLE: Apply Responsive Background Images with Tailwind CSS DESCRIPTION: This example illustrates how to make background image utilities responsive by prefixing them with breakpoint variants like `md:`. This ensures that the utility is only applied at the specified screen size and above, enabling adaptive designs. SOURCE: https://tailwindcss.com/docs/background-image LANGUAGE: html CODE: ``` <div class="from-purple-400 md:from-yellow-500 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: HTML Example for Tailwind CSS mask-composite Responsive Design DESCRIPTION: Illustrates how to apply `mask-composite` utilities conditionally based on screen size using Tailwind CSS's responsive variants. This example shows a `div` element that applies `mask-add` by default and switches to `mask-subtract` on medium screens and above. SOURCE: https://tailwindcss.com/docs/mask-composite LANGUAGE: HTML CODE: ``` <div class="mask-add md:mask-subtract ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Transition Properties in Tailwind CSS DESCRIPTION: This example demonstrates how to apply transition properties conditionally based on screen size using responsive variants in Tailwind CSS. The `md:transition-all` class ensures that all properties transition only on medium screens and above, while `transition-none` applies by default. SOURCE: https://tailwindcss.com/docs/transition-property LANGUAGE: HTML CODE: ``` <button class="transition-none md:transition-all ..."> <!-- ... --></button> ``` ---------------------------------------- TITLE: Apply Border Radius with Logical Properties in HTML DESCRIPTION: Demonstrates the use of `rounded-s-lg` with `dir="ltr"` and `dir="rtl"` to show how logical properties adapt to text direction for border radius, ensuring consistent visual behavior across different writing modes. SOURCE: https://tailwindcss.com/docs/border-radius LANGUAGE: HTML CODE: ``` <div dir="ltr"> <div class="rounded-s-lg ..."></div></div><div dir="rtl"> <div class="rounded-s-lg ..."></div></div> ``` ---------------------------------------- TITLE: Apply Responsive Margin in Tailwind CSS DESCRIPTION: Shows how to apply margin utilities conditionally based on screen size using responsive variants like `md:` in Tailwind CSS. This allows for different margin values at various breakpoints. SOURCE: https://tailwindcss.com/docs/margin LANGUAGE: HTML CODE: ``` <div class="mt-4 md:mt-8 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Revert to Normal Scrolling with Tailwind CSS and Media Queries in HTML DESCRIPTION: This example shows how to use the `scroll-auto` utility to revert to the default browser scrolling behavior. It also illustrates combining it with a responsive media query (`md:scroll-auto`) to apply normal scrolling only on medium screens and above, while retaining smooth scrolling on smaller screens. SOURCE: https://tailwindcss.com/docs/scroll-behavior LANGUAGE: HTML CODE: ``` <html class="scroll-smooth md:scroll-auto"> <!-- ... --></html> ``` ---------------------------------------- TITLE: Apply Responsive Line Clamping with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply `line-clamp` utilities responsively using breakpoint variants like `md:`. This allows developers to define different truncation behaviors based on screen size, ensuring optimal text display across various devices and viewports. SOURCE: https://tailwindcss.com/docs/line-clamp LANGUAGE: html CODE: ``` <div class="line-clamp-3 md:line-clamp-4 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Applying Responsive Perspective Utilities in Tailwind CSS DESCRIPTION: This snippet shows how to apply perspective utilities conditionally based on screen sizes using responsive prefixes. For instance, `md:perspective-dramatic` applies a dramatic perspective only on medium screens and larger, allowing for adaptive designs. SOURCE: https://tailwindcss.com/docs/perspective LANGUAGE: HTML CODE: ``` <div class="perspective-midrange md:perspective-dramatic ..."> <!-- ... --> </div> ``` ---------------------------------------- TITLE: Applying Responsive Blending Modes in Tailwind CSS DESCRIPTION: This snippet illustrates how to apply `mix-blend-mode` utilities conditionally based on screen size using responsive variants. By prefixing a utility with a breakpoint like `md:`, the blending mode will only be active at that screen size and above, allowing for adaptive designs. SOURCE: https://tailwindcss.com/docs/mix-blend-mode LANGUAGE: HTML CODE: ``` <div class="mix-blend-multiply md:mix-blend-overlay ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Minimum Height with Tailwind CSS DESCRIPTION: This HTML snippet illustrates how to apply responsive minimum height utilities using breakpoint variants in Tailwind CSS. By prefixing `min-h` utilities with `md:`, the `min-h-full` class will only be applied at medium screen sizes and above, while `min-h-0` is the default. This allows for adaptive layouts based on screen dimensions. SOURCE: https://tailwindcss.com/docs/min-height LANGUAGE: HTML CODE: ``` <div class="h-24 min-h-0 md:min-h-full ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Width with Tailwind CSS Breakpoint Variants DESCRIPTION: This code demonstrates how to make width utilities responsive by prefixing them with breakpoint variants like `md:`. This ensures that the specified width (e.g., `w-full`) only applies at or above the defined screen size, enabling adaptive layouts. SOURCE: https://tailwindcss.com/docs/width LANGUAGE: HTML CODE: ``` <div class="w-1/2 md:w-full ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Perspective Origin in Tailwind CSS DESCRIPTION: Explains how to apply `perspective-origin` utilities conditionally based on screen size using responsive prefixes like `md:`. This enables adaptive designs where the perspective origin changes for different breakpoints. SOURCE: https://tailwindcss.com/docs/perspective-origin LANGUAGE: HTML CODE: ``` <div class="perspective-origin-center md:perspective-origin-bottom-left ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: HTML Example of Conflicting Tailwind Utility Classes DESCRIPTION: Illustrates a scenario where an HTML element has two conflicting Tailwind utility classes (`grid` and `flex`). This highlights how CSS specificity rules dictate which style takes precedence, with the later class in the stylesheet winning. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div class="grid flex"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Stacked Arbitrary and Built-in Variants DESCRIPTION: Illustrates stacking an arbitrary variant (`is-dragging`) with a built-in variant (`active`) to apply `cursor-grabbing` when an element is both dragging and active. This showcases the composability of Tailwind CSS variants for complex state-based styling. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <ul role="list"> {#each items as item} <li class="[&.is-dragging]:active:cursor-grabbing">{item}</li> {/each}</ul> ``` ---------------------------------------- TITLE: HTML with Inline Grid Template Columns DESCRIPTION: Demonstrates using an inline `style` attribute for complex CSS values, specifically for `grid-template-columns`, which can be difficult to format as a Tailwind class name. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div class="grid-[2fr_max(0,var(--gutter-width))_calc(var(--gutter-width)+10px)]"><div style="grid-template-columns: 2fr max(0, var(--gutter-width)) calc(var(--gutter-width) + 10px)"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS: Applying styles when environment condition is not true with not-supports- DESCRIPTION: Demonstrates using the `not-` variant with a media query variant like `supports`. This specific example applies `flex` display to a div only if the browser does NOT support CSS Grid, allowing for graceful degradation or alternative layouts based on browser capabilities. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div class="not-supports-[display:grid]:flex"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS auto-cols with Custom Values and CSS Variables DESCRIPTION: Illustrates how to use custom values and CSS variables with the `auto-cols` utility in Tailwind CSS. This allows for highly flexible control over implicitly-created grid column sizes, including specific CSS values or dynamic values from custom properties. SOURCE: https://tailwindcss.com/docs/grid-auto-columns LANGUAGE: HTML CODE: ``` <div class="auto-cols-[minmax(0,2fr)] ..."> <!-- ... --></div> ``` LANGUAGE: HTML CODE: ``` <div class="auto-cols-(--my-auto-cols) ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Allow Text Selection with Tailwind CSS DESCRIPTION: Illustrates how to explicitly allow text selection within an HTML element and its children using the `select-text` utility class in Tailwind CSS. This ensures standard text selection behavior. SOURCE: https://tailwindcss.com/docs/user-select LANGUAGE: HTML CODE: ``` <div class="select-text ...">The quick brown fox jumps over the lazy dog.</div> ``` ---------------------------------------- TITLE: Responsive Grid Column Configuration in Tailwind CSS DESCRIPTION: This HTML snippet showcases how to create a responsive grid layout using Tailwind CSS. It defines a single-column grid for smaller screens (`grid-cols-1`) and transitions to a six-column grid for medium screens and larger (`md:grid-cols-6`) by leveraging breakpoint variants. SOURCE: https://tailwindcss.com/docs/grid-template-columns LANGUAGE: HTML CODE: ``` <div class="grid grid-cols-1 md:grid-cols-6 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS Backdrop Filters DESCRIPTION: Explains how to apply backdrop filter utilities conditionally based on screen size using responsive prefixes like `md:` in Tailwind CSS. This enables adaptive designs where filter effects change or are removed at different breakpoints. SOURCE: https://tailwindcss.com/docs/backdrop-filter LANGUAGE: html CODE: ``` <div class="backdrop-blur-sm md:backdrop-filter-none ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Font Weight with Tailwind CSS DESCRIPTION: Demonstrates how to apply a responsive font weight using Tailwind CSS utility classes. The `md:font-bold` class ensures the bold font weight is applied only on medium screens and above, while `font-normal` serves as the default. SOURCE: https://tailwindcss.com/docs/font-weight LANGUAGE: HTML CODE: ``` <p class="font-normal md:font-bold ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Define Tailwind CSS Utility with Multiple Value Arguments DESCRIPTION: This CSS snippet demonstrates using the `--value()` function with multiple arguments to resolve values left to right without needing separate declarations. It shows how to combine theme, bare, and arbitrary values for `tab-size` and `opacity` utilities efficiently. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: CSS CODE: ``` @theme { --tab-size-github: 8;}@utility tab-* { tab-size: --value(--tab-size-*, integer, [integer]);} ``` LANGUAGE: CSS CODE: ``` @utility opacity-* { opacity: calc(--value(integer) * 1%); opacity: --value(--opacity-*, [percentage]);} ``` ---------------------------------------- TITLE: Apply Diagonal Fractions with Tailwind CSS DESCRIPTION: Illustrates the use of the `diagonal-fractions` utility class in Tailwind CSS to convert numbers separated by a slash into common diagonal fraction glyphs, where supported by the font. SOURCE: https://tailwindcss.com/docs/font-variant-numeric LANGUAGE: html CODE: ``` <p class="diagonal-fractions ...">1/2 3/4 5/6</p> ``` ---------------------------------------- TITLE: CSS Equivalent for Tailwind Complex Selector DESCRIPTION: Illustrates the simplified CSS output corresponding to a complex Tailwind class, showing how media queries, pseudo-classes, and attribute selectors are combined. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: CSS CODE: ``` @media (prefers-color-scheme: dark) and (width >= 64rem) { button[data-current]:hover { background-color: var(--color-indigo-600); }} ``` ---------------------------------------- TITLE: Tailwind CSS User Select Utilities DESCRIPTION: Provides API documentation for Tailwind CSS `user-select` utilities, which control how users can select text within an element. It details the available classes and their corresponding CSS properties. SOURCE: https://tailwindcss.com/docs/user-select LANGUAGE: APIDOC CODE: ``` user-select Utilities: Class | Styles -------------|------------------ `select-none`| `user-select: none;` `select-text`| `user-select: text;` `select-all` | `user-select: all;` `select-auto`| `user-select: auto;` ``` ---------------------------------------- TITLE: Apply Responsive Brightness in Tailwind CSS DESCRIPTION: Shows how to apply different brightness values based on screen size using Tailwind CSS's responsive variants. By prefixing the `brightness` utility with a breakpoint variant like `md:`, the utility will only apply at medium screen sizes and above, enabling adaptive designs. SOURCE: https://tailwindcss.com/docs/filter-brightness LANGUAGE: HTML CODE: ``` <img class="brightness-110 md:brightness-150 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Using Custom Tailwind CSS @supports Variants DESCRIPTION: This HTML snippet demonstrates the usage of a custom `@supports` variant, `supports-grid:grid`, which was previously defined. This allows for a more concise way to apply styles conditionally based on browser feature support, improving code readability. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div class="supports-grid:grid"> <!-- ... --> </div> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS place-items Utility DESCRIPTION: This HTML snippet demonstrates how to make a Tailwind CSS `place-items` utility responsive. By prefixing `place-items-center` with `md:`, the element's content will be centered horizontally and vertically only on medium screens and larger, while defaulting to `place-items-start` on smaller screens. SOURCE: https://tailwindcss.com/docs/place-items LANGUAGE: HTML CODE: ``` <div class="grid place-items-start md:place-items-center ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Border Styles with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply different border styles based on screen size using Tailwind CSS utility classes. The `border-solid` class applies a solid border by default, while `md:border-dotted` overrides it to a dotted border for medium screen sizes and above, showcasing responsive design principles. SOURCE: https://tailwindcss.com/docs/border-style LANGUAGE: html CODE: ``` <div class="border-solid md:border-dotted ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Utilize Custom Container Query Sizes in Tailwind CSS HTML DESCRIPTION: Shows how to apply a custom-defined container query size (e.g., `@8xl`) within HTML markup. This enables responsive styling based on the custom container breakpoint, integrating seamlessly with your extended theme. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-col @8xl:flex-row"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Applying Responsive Table Caption Position with Tailwind CSS DESCRIPTION: This snippet illustrates how to apply a responsive table caption position using Tailwind CSS. The `md:caption-bottom` variant ensures the caption is at the bottom only on medium screens and above, while `caption-top` is the default for smaller screens. SOURCE: https://tailwindcss.com/docs/caption-side LANGUAGE: HTML CODE: ``` <caption class="caption-top md:caption-bottom ..."> <!-- ... --></caption> ``` ---------------------------------------- TITLE: Tailwind CSS Orientation Media Query DESCRIPTION: This example illustrates how to use `portrait` and `landscape` variants in Tailwind CSS to conditionally hide or display content based on the viewport's orientation. It's useful for designing responsive layouts that adapt to device rotation, such as showing a message when a site is best viewed in landscape mode. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div> <div class="portrait:hidden"> <!-- ... --> </div> <div class="landscape:hidden"> <p>This experience is designed to be viewed in landscape. Please rotate your device to view the site.</p> </div> </div> ``` ---------------------------------------- TITLE: Apply Proximity Scroll Snapping with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to implement proximity-based scroll snapping using Tailwind CSS utilities. The `snap-x` and `snap-proximity` classes are applied to the container to enable horizontal snapping, while `snap-center` is used on child elements to define their snap points. This ensures the scroll container comes to rest on snap points that are close in proximity. SOURCE: https://tailwindcss.com/docs/scroll-snap-type LANGUAGE: HTML CODE: ``` <div class="snap-x snap-proximity ..."> <div class="snap-center ..."> <img src="/img/vacation-01.jpg" /> </div> <div class="snap-center ..."> <img src="/img/vacation-02.jpg" /> </div> <div class="snap-center ..."> <img src="/img/vacation-03.jpg" /> </div> <div class="snap-center ..."> <img src="/img/vacation-04.jpg" /> </div> <div class="snap-center ..."> <img src="/img/vacation-05.jpg" /> </div></div> ``` ---------------------------------------- TITLE: Responsive Scroll Snap Alignment with Tailwind CSS Breakpoints DESCRIPTION: This example illustrates how to apply responsive scroll snap alignment using Tailwind CSS. The `snap-center` class provides a default alignment, while `md:snap-start` overrides it for medium screen sizes and above, demonstrating how to use breakpoint variants for adaptive designs. SOURCE: https://tailwindcss.com/docs/scroll-snap-align LANGUAGE: HTML CODE: ``` <div class="snap-center md:snap-start ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Background Blend Mode with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply different background blend modes based on screen size using Tailwind CSS. It utilizes `bg-blend-lighten` for smaller screens and `md:bg-blend-darken` for medium screens and above, showcasing Tailwind's responsive variants for dynamic styling. SOURCE: https://tailwindcss.com/docs/background-blend-mode LANGUAGE: html CODE: ``` <div class="bg-blue-500 bg-[url(/img/mountains.jpg)] bg-blend-lighten md:bg-blend-darken ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Fill Color Utility DESCRIPTION: No description SOURCE: https://tailwindcss.com/docs/fill ---------------------------------------- TITLE: Apply Responsive Backdrop Saturation with Tailwind CSS DESCRIPTION: This snippet illustrates how to apply different `backdrop-saturate` values based on screen size using Tailwind CSS's responsive variants. The `md:` prefix ensures the utility is applied only at medium screen sizes and above, allowing for adaptive designs. SOURCE: https://tailwindcss.com/docs/backdrop-filter-saturate LANGUAGE: html CODE: ``` <div class="backdrop-saturate-50 md:backdrop-saturate-150 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Applying Max-Width Container Queries in Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply styles based on a maximum container width using Tailwind CSS container queries. Variants like `@max-md` allow you to apply styles to child elements when the parent container's size is below a specific threshold. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-row @max-md:flex-col"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Apply Responsive Sepia Filter with Tailwind CSS DESCRIPTION: Demonstrates how to use Tailwind CSS responsive variants to apply a sepia filter to an image and then remove it at medium screen sizes and above. This allows for dynamic styling based on viewport width. SOURCE: https://tailwindcss.com/docs/filter-sepia LANGUAGE: HTML CODE: ``` <img class="sepia md:sepia-0 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Apply Responsive Animations with Tailwind CSS DESCRIPTION: Explains how to use breakpoint variants (e.g., `md:`) to apply animation utilities only at specific screen sizes and above. This enables responsive animation behavior. SOURCE: https://tailwindcss.com/docs/animation LANGUAGE: HTML CODE: ``` <div class="animate-none md:animate-spin ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Backdrop Contrast with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to use Tailwind CSS utility classes to apply a `backdrop-contrast` filter that changes based on screen size. The `md:` prefix ensures the `backdrop-contrast-150` utility is only applied on medium screens and above, overriding the default `backdrop-contrast-125`. SOURCE: https://tailwindcss.com/docs/backdrop-filter-contrast LANGUAGE: HTML CODE: ``` <div class="backdrop-contrast-125 md:backdrop-contrast-150 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive place-self Utilities in Tailwind CSS DESCRIPTION: This HTML example illustrates how to apply `place-self` utilities responsively using Tailwind CSS breakpoint variants. By prefixing `place-self-end` with `md:`, the item will align to the start by default and then align to the end only on medium screen sizes and above, adapting its position based on the viewport. SOURCE: https://tailwindcss.com/docs/place-self LANGUAGE: html CODE: ``` <div class="place-self-start md:place-self-end ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Backdrop Hue Rotation with Tailwind CSS DESCRIPTION: Demonstrates how to make backdrop hue rotation responsive using Tailwind CSS breakpoint variants. By prefixing utilities like `md:`, the effect can be applied conditionally based on screen size. SOURCE: https://tailwindcss.com/docs/backdrop-filter-hue-rotate LANGUAGE: html CODE: ``` <div class="backdrop-hue-rotate-15 md:backdrop-hue-rotate-0 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Grid Layout with Tailwind CSS Breakpoints DESCRIPTION: This HTML snippet shows how to create a responsive grid layout using Tailwind CSS breakpoint prefixes. The `sm:grid-cols-3` class ensures the grid changes from 2 to 3 columns at the small breakpoint (40rem) and above. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div class="grid grid-cols-2 sm:grid-cols-3"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Hyphenation with Tailwind CSS DESCRIPTION: This snippet demonstrates how to apply hyphenation utilities responsively using Tailwind CSS. By prefixing `hyphens` utilities with breakpoint variants (e.g., `md:`), the styling is applied only at specified screen sizes and above, allowing for adaptive text formatting. SOURCE: https://tailwindcss.com/docs/hyphens LANGUAGE: HTML CODE: ``` <p class="hyphens-none md:hyphens-auto ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Registering functional utilities with argument acceptance DESCRIPTION: Explains how to define functional utility classes that accept an argument using the `@utility` directive and the special `--value()` function. This enables creating dynamic utilities where the value is passed directly in the class name. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: CSS CODE: ``` @utility tab-* { tab-size: --value(--tab-size-*);} ``` ---------------------------------------- TITLE: Responsive Item Alignment with Tailwind CSS DESCRIPTION: This HTML example illustrates how to apply responsive `align-items` utilities in Tailwind CSS. By using breakpoint prefixes like `md:`, the `items-center` alignment is applied only from medium screen sizes upwards, while `items-stretch` is the default for smaller screens. This allows for flexible layout adjustments based on screen dimensions. SOURCE: https://tailwindcss.com/docs/align-items LANGUAGE: html CODE: ``` <div class="flex items-stretch md:items-center ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS Filter DESCRIPTION: Demonstrates applying a filter utility responsively using Tailwind CSS breakpoint variants. The `md:filter-none` class removes filters on medium screens and above, adapting the design for different screen sizes. SOURCE: https://tailwindcss.com/docs/filter LANGUAGE: HTML CODE: ``` <img class="blur-sm md:filter-none ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Targeting Container Query Ranges in Tailwind CSS DESCRIPTION: This example shows how to target a specific range for container queries by stacking a regular container query variant with a max-width container query variant. This allows for precise styling of child elements when the parent container falls within a defined size range. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-row @sm:@max-md:flex-col"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Tailwind CSS grid-auto-columns Utility Classes DESCRIPTION: API documentation for the `grid-auto-columns` utility in Tailwind CSS, which controls the size of implicitly-created grid columns. This entry details the available utility classes and their corresponding CSS properties, including options for auto, min-content, max-content, fractional units, and custom values. SOURCE: https://tailwindcss.com/docs/grid-auto-columns LANGUAGE: APIDOC CODE: ``` grid-auto-columns: - Class: `auto-cols-auto` Styles: `grid-auto-columns: auto;` - Class: `auto-cols-min` Styles: `grid-auto-columns: min-content;` - Class: `auto-cols-max` Styles: `grid-auto-columns: max-content;` - Class: `auto-cols-fr` Styles: `grid-auto-columns: minmax(0, 1fr);` - Class: `auto-cols-(<custom-property>)` Styles: `grid-auto-columns: var(<custom-property>);` - Class: `auto-cols-[<value>]` Styles: `grid-auto-columns: <value>;` Purpose: Utilities for controlling the size of implicitly-created grid columns. Usage: Apply these classes directly to a grid container to define how auto-placed columns are sized. Parameters: Varies by class, typically a predefined keyword or a custom CSS value. Returns: Modifies the CSS `grid-auto-columns` property. ``` ---------------------------------------- TITLE: Apply Responsive Letter Spacing with Tailwind CSS DESCRIPTION: Shows how to apply different letter spacing values based on screen size using Tailwind CSS responsive variants. The `md:` prefix applies the `tracking-wide` utility only at medium screen sizes and above, overriding the default `tracking-tight`. SOURCE: https://tailwindcss.com/docs/letter-spacing LANGUAGE: HTML CODE: ``` <p class="tracking-tight md:tracking-wide ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Tailwind CSS `has-*` variant for parent styling based on descendant state DESCRIPTION: This HTML snippet demonstrates the `has-checked:bg-indigo-50` variant, which allows a parent element (e.g., a label) to be styled based on the state of its descendants (e.g., a checked radio input). This powerful variant enables complex UI interactions where a parent's appearance changes dynamically based on the content or state of its children, such as highlighting a payment method when its radio button is selected. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <label class="has-checked:bg-indigo-50 has-checked:text-indigo-900 has-checked:ring-indigo-200 dark:has-checked:bg-indigo-950 dark:has-checked:text-indigo-200 dark:has-checked:ring-indigo-900 ..."> <svg fill="currentColor"> <!-- ... --> </svg> Google Pay <input type="radio" class="checked:border-indigo-500 ..." /></label> ``` ---------------------------------------- TITLE: Apply Responsive justify-items Utilities in Tailwind CSS DESCRIPTION: Shows how to apply `justify-items` utilities responsively using breakpoint variants like `md:`. This allows for different item alignment behaviors based on screen size, enabling adaptive layouts for various devices. SOURCE: https://tailwindcss.com/docs/justify-items LANGUAGE: HTML CODE: ``` <div class="grid justify-items-start md:justify-items-center ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Brightness Filter with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply a `backdrop-filter: brightness()` utility responsively using Tailwind CSS. The `md:` breakpoint variant ensures that the `backdrop-brightness-150` class is only applied at medium screen sizes and above, overriding the default `backdrop-brightness-110` for smaller screens. This allows for dynamic visual adjustments based on the viewport size. SOURCE: https://tailwindcss.com/docs/backdrop-filter-brightness LANGUAGE: HTML CODE: ``` <div class="backdrop-brightness-110 md:backdrop-brightness-150 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Basic UI Card with Utility Classes DESCRIPTION: This HTML snippet demonstrates a simple UI card component styled entirely using Tailwind CSS utility classes. It showcases how classes like `mx-auto`, `flex`, `max-w-sm`, `p-6`, `bg-white`, `rounded-xl`, `shadow-lg`, `text-xl`, and `text-gray-500` are combined directly in the markup to control layout, spacing, background, borders, shadows, and text appearance, illustrating the utility-first approach. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: HTML CODE: ``` <div class="mx-auto flex max-w-sm items-center gap-x-4 rounded-xl bg-white p-6 shadow-lg outline outline-black/5 dark:bg-slate-800 dark:shadow-none dark:-outline-offset-1 dark:outline-white/10"> <img class="size-12 shrink-0" src="/img/logo.svg" alt="ChitChat Logo" /> <div> <div class="text-xl font-medium text-black dark:text-white">ChitChat</div> <p class="text-gray-500 dark:text-gray-400">You have a new message!</p> </div></div> ``` ---------------------------------------- TITLE: Tailwind CSS: @utility Directive DESCRIPTION: The `@utility` directive enables adding custom utility classes to a Tailwind project that can work seamlessly with variants like `hover`, `focus`, and responsive breakpoints (e.g., `lg`). This allows for extending Tailwind's utility-first approach with project-specific styles. SOURCE: https://tailwindcss.com/docs/functions-and-directives LANGUAGE: CSS CODE: ``` @utility tab-4 { tab-size: 4;} ``` ---------------------------------------- TITLE: Apply Responsive Outline Colors with Tailwind CSS DESCRIPTION: Explains how to make outline colors responsive by using breakpoint variants like `md:`, ensuring the utility is applied only at specified screen sizes and above. SOURCE: https://tailwindcss.com/docs/outline-color LANGUAGE: HTML CODE: ``` <div class="outline md:outline-blue-400 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Define Tailwind CSS Utility with Arbitrary Values DESCRIPTION: This CSS snippet shows how to define a Tailwind CSS utility that accepts arbitrary values of a specified type, such as `integer`, using the `--value([type])` syntax. It enables utilities like `tab-[1]` or `tab-[76]`. Using `[*]` supports any data type. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: CSS CODE: ``` @utility tab-* { tab-size: --value([integer]);} ``` ---------------------------------------- TITLE: Apply Stacked Fractions with Tailwind CSS DESCRIPTION: Shows how to apply the `stacked-fractions` utility class in Tailwind CSS to transform numbers separated by a slash into common stacked fraction glyphs, provided the font supports them. SOURCE: https://tailwindcss.com/docs/font-variant-numeric LANGUAGE: html CODE: ``` <p class="stacked-fractions ...">1/2 3/4 5/6</p> ``` ---------------------------------------- TITLE: HTML List with Tailwind CSS list-outside Class DESCRIPTION: An HTML snippet demonstrating the use of the `list-outside` Tailwind CSS utility class to position list markers outside the content flow, maintaining standard text indentation. SOURCE: https://tailwindcss.com/docs/list-style-position LANGUAGE: HTML CODE: ``` <ul class="list-outside"> <li>5 cups chopped Porcini mushrooms</li> <!-- ... --></ul> ``` ---------------------------------------- TITLE: Apply Responsive Filter with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to use Tailwind CSS utility classes to apply a filter (e.g., `invert`) responsively. The `invert` class applies an inversion filter by default, while `md:invert-0` removes the inversion filter on medium screens and above, effectively making the image normal at larger sizes. SOURCE: https://tailwindcss.com/docs/filter-invert LANGUAGE: HTML CODE: ``` <img class="invert md:invert-0 ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Tailwind CSS Transform Utilities DESCRIPTION: API documentation for Tailwind CSS utilities that apply 2D and 3D transformations to elements, such as rotation, scaling, skewing, and translation. SOURCE: https://tailwindcss.com/docs/text-decoration-color LANGUAGE: APIDOC CODE: ``` Transforms Properties: - backface-visibility - perspective - perspective-origin - rotate - scale - skew - transform - transform-origin - transform-style - translate ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS background-origin DESCRIPTION: Illustrates how to use responsive design with Tailwind CSS `background-origin` utilities by applying different origin styles based on screen size using breakpoint variants like `md:`. SOURCE: https://tailwindcss.com/docs/background-origin LANGUAGE: html CODE: ``` <div class="bg-origin-border md:bg-origin-padding ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Word Break with Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply responsive word-break utilities using Tailwind CSS. The `break-normal` class sets the default word-break behavior, while `md:break-all` applies `word-break: break-all;` specifically for medium screen sizes and above, ensuring text breaks at any character to prevent overflow. SOURCE: https://tailwindcss.com/docs/word-break LANGUAGE: HTML CODE: ``` <p class="break-normal md:break-all ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Tailwind CSS Peer Variant for Sibling Styling DESCRIPTION: Demonstrates how to style an element based on the state of a *previous* sibling using the `peer` class and `peer-*` variants (e.g., `peer-invalid`). This is useful for dynamic form validation messages or other sibling-dependent UI changes, such as showing an error message when an input is invalid. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <form> <label class="block"> <span class="...">Email</span> <input type="email" class="peer ..." /> <p class="invisible peer-invalid:visible ...">Please provide a valid email address.</p> </label></form> ``` ---------------------------------------- TITLE: Apply Responsive Tailwind CSS mask-clip Utilities DESCRIPTION: Illustrates how to use responsive variants like `md:` with `mask-clip` utilities to apply different masking behaviors based on screen size. This example shows how to conditionally apply `mask-clip-padding` on medium screens and above, while `mask-clip-border` is applied by default. SOURCE: https://tailwindcss.com/docs/mask-clip LANGUAGE: HTML CODE: ``` <div class="mask-clip-border md:mask-clip-padding ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Tailwind CSS :indeterminate Variant DESCRIPTION: Shows how to style a checkbox or radio button when it is in an indeterminate state using the `indeterminate` variant. This state is typically used for parent checkboxes where some, but not all, child items are selected. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <input type="checkbox" class="appearance-none indeterminate:bg-gray-300 ..." /> ``` ---------------------------------------- TITLE: Apply Responsive Fill Colors to SVG in Tailwind CSS DESCRIPTION: Illustrates how to apply different fill colors based on screen size using responsive variants like `md:`. This allows for adaptive styling of SVG elements, changing their fill color at specific breakpoints. SOURCE: https://tailwindcss.com/docs/fill LANGUAGE: HTML CODE: ``` <svg class="fill-cyan-500 md:fill-cyan-700 ..."> <!-- ... --></svg> ``` ---------------------------------------- TITLE: Tailwind CSS Arbitrary Peer Variants with Custom Selectors DESCRIPTION: This example illustrates how to create one-off `peer-*` variants using arbitrary values, allowing you to provide your own CSS selector within square brackets (e.g., `peer-[.is-dirty]`). This enables styling based on custom classes or other complex selector conditions applied to a peer element. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <form> <label for="email">Email:</label> <input id="email" name="email" type="email" class="is-dirty peer" required /> <div class="peer-[.is-dirty]:peer-required:block hidden">This field is required.</div> <!-- ... --></form> ``` ---------------------------------------- TITLE: Basic Usage of Tailwind CSS auto-cols-max for Grid Columns DESCRIPTION: Demonstrates the basic application of `auto-cols-max` to control the size of implicitly-created grid columns in a flexbox layout. This example shows how to make grid columns expand to their maximum content size. SOURCE: https://tailwindcss.com/docs/grid-auto-columns LANGUAGE: HTML CODE: ``` <div class="grid auto-cols-max grid-flow-col"> <div>01</div> <div>02</div> <div>03</div></div> ``` ---------------------------------------- TITLE: Apply Arbitrary Values for Positioning and Responsiveness in Tailwind CSS DESCRIPTION: Demonstrates how to use square bracket notation to apply arbitrary `top` values, similar to inline styles, but with the added benefit of combining them with responsive modifiers like `lg` for different screen sizes. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: HTML CODE: ``` <div class="top-[117px]"> <!-- ... --></div> ``` LANGUAGE: HTML CODE: ``` <div class="top-[117px] lg:top-[344px]"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Using Arbitrary Breakpoint Values in Tailwind CSS DESCRIPTION: This snippet shows how to apply styles using one-off, arbitrary breakpoint values directly in your HTML. This is useful for unique cases that don't warrant adding a new breakpoint to your theme, using `max-[]` or `min-[]` variants. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="max-[600px]:bg-sky-300 min-[320px]:text-center"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Line Height with Tailwind CSS DESCRIPTION: Explains how to use responsive design prefixes like `md:` with line height utilities in Tailwind CSS. This allows the line height to change based on different screen sizes, applying the utility only at specified breakpoints and above. SOURCE: https://tailwindcss.com/docs/line-height LANGUAGE: HTML CODE: ``` <p class="leading-5 md:leading-6 ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive `white-space` Utilities with Tailwind CSS Breakpoints DESCRIPTION: Tailwind CSS allows applying `white-space` utilities conditionally based on screen size using responsive variants like `md:`. This enables dynamic text wrapping behavior, for example, preserving preformatted text on small screens and allowing normal wrapping on larger screens. SOURCE: https://tailwindcss.com/docs/white-space LANGUAGE: HTML CODE: ``` <p class="whitespace-pre md:whitespace-normal ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Apply Responsive Blur in Tailwind CSS DESCRIPTION: Shows how to apply different blur utilities based on screen sizes using Tailwind CSS responsive variants, such as `md:blur-lg`, ensuring adaptive design. SOURCE: https://tailwindcss.com/docs/filter-blur LANGUAGE: HTML CODE: ``` <img class="blur-none md:blur-lg ..." src="/img/mountains.jpg" /> ``` ---------------------------------------- TITLE: Tailwind CSS List Style Position Utilities DESCRIPTION: Documents the Tailwind CSS utility classes for controlling the position of list markers, including `list-inside` and `list-outside`, and their corresponding CSS properties. It also provides examples for basic and responsive usage. SOURCE: https://tailwindcss.com/docs/list-style-position LANGUAGE: APIDOC CODE: ``` Class | Styles --- | --- list-inside | list-style-position: inside; list-outside | list-style-position: outside; Usage Examples: Basic Example: <ul class="list-inside"> <li>5 cups chopped Porcini mushrooms</li> <li>1/2 cup of olive oil</li> <li>3lb of celery</li> </ul> <ul class="list-outside"> <li>5 cups chopped Porcini mushrooms</li> <li>1/2 cup of olive oil</li> <li>3lb of celery</li> </ul> Responsive Design Example: <ul class="list-outside md:list-inside ..."> <!-- ... --> </ul> ``` ---------------------------------------- TITLE: Apply clear-both utility in HTML DESCRIPTION: The `clear-both` utility is designed to position an element below all preceding floated elements, regardless of whether they are floated left or right. This is useful for ensuring an element always appears below all floating content. SOURCE: https://tailwindcss.com/docs/clear LANGUAGE: HTML CODE: ``` <article> <img class="float-left ..." src="/img/snow-mountains.jpg" /> <img class="float-right ..." src="/img/green-mountains.jpg" /> <p class="clear-both ...">Maybe we can live without libraries...</p></article> ``` ---------------------------------------- TITLE: Apply Responsive Grid Rows in Tailwind CSS DESCRIPTION: This HTML snippet demonstrates how to apply responsive grid row utilities in Tailwind CSS. By prefixing `grid-rows-6` with `md:`, the grid will have 6 rows on medium screens and above, while `grid-rows-2` applies to smaller screens. This allows for adaptive layouts based on viewport size. SOURCE: https://tailwindcss.com/docs/grid-template-rows LANGUAGE: HTML CODE: ``` <div class="grid grid-rows-2 md:grid-rows-6 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: CSS Definitions for Conflicting Display Utilities DESCRIPTION: Provides the underlying CSS definitions for the `flex` and `grid` utility classes. This snippet explains why, when conflicting classes are applied, the one defined later in the stylesheet (e.g., `grid`) will override the earlier one (`flex`). SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: CSS CODE: ``` .flex { display: flex; }.grid { display: grid; } ``` ---------------------------------------- TITLE: HTML Example: Textarea with Content-Based Sizing DESCRIPTION: Demonstrates how to use the `field-sizing-content` utility class on a `textarea` element. This allows the textarea to automatically adjust its width based on the length of its content, providing a dynamic user experience. SOURCE: https://tailwindcss.com/docs/field-sizing LANGUAGE: HTML CODE: ``` <textarea class="field-sizing-content ..." rows="2"> Latex Salesman, Vanderlay Industries</textarea> ``` ---------------------------------------- TITLE: Apply Arbitrary Variants for On-the-Fly Selector Modification in Tailwind CSS DESCRIPTION: Demonstrates how arbitrary variants enable dynamic selector modification, similar to built-in pseudo-class or responsive variants, by embedding custom selector logic directly within the HTML class attribute. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: HTML CODE: ``` <ul role="list"> {#each items as item} <li class="lg:[&:nth-child(-n+3)]:hover:underline">{item}</li> {/each}</ul> ``` ---------------------------------------- TITLE: Apply Margin to Specific Sides of an Element DESCRIPTION: Illustrates the use of directional margin utilities like `mt-<number>`, `mr-<number>`, `mb-<number>`, and `ml-<number>` in Tailwind CSS. These classes allow precise control over the top, right, bottom, and left margins of an HTML element. SOURCE: https://tailwindcss.com/docs/margin LANGUAGE: HTML CODE: ``` <div class="mt-6 ...">mt-6</div><div class="mr-4 ...">mr-4</div><div class="mb-8 ...">mb-8</div><div class="ml-2 ...">ml-2</div> ``` ---------------------------------------- TITLE: Tailwind CSS place-items Utility Classes DESCRIPTION: Documents the `place-items` utility in Tailwind CSS, which controls how grid or flex items are justified and aligned simultaneously. It lists available classes and their corresponding CSS styles, providing a comprehensive reference for configuring item placement. SOURCE: https://tailwindcss.com/docs/place-items LANGUAGE: APIDOC CODE: ``` place-items: - place-items-start: place-items: start; - place-items-end: place-items: end; - place-items-end-safe: place-items: safe end; - place-items-center: place-items: center; - place-items-center-safe: place-items: safe center; - place-items-baseline: place-items: baseline; - place-items-stretch: place-items: stretch; ``` ---------------------------------------- TITLE: Apply Responsive `font-style` with Tailwind CSS Breakpoints DESCRIPTION: Shows how to apply `font-style` utilities responsively using Tailwind CSS breakpoint variants. This example applies `italic` by default and `not-italic` from medium screen sizes (`md:`) and above, allowing for adaptive typography based on screen dimensions. SOURCE: https://tailwindcss.com/docs/font-style LANGUAGE: HTML CODE: ``` <p class="italic md:not-italic ..."> Lorem ipsum dolor sit amet...</p> ``` ---------------------------------------- TITLE: Tailwind CSS Styling ::placeholder Pseudo-element DESCRIPTION: This snippet demonstrates how to style the placeholder text within input fields or textareas using the `placeholder:` variant. It allows for custom styling of the temporary text that appears before user input, enhancing the visual design of forms. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <input class="placeholder:text-gray-500 placeholder:italic ..." placeholder="Search for anything..." type="text" name="search"/> ``` ---------------------------------------- TITLE: Handle Fractions in Tailwind CSS Utilities with Ratio Data Type DESCRIPTION: This CSS snippet shows how to handle fractions in Tailwind CSS utilities by using the CSS `ratio` data type with `--value()`. This signals Tailwind to treat the value and modifier as a single unit, enabling utilities like `aspect-square`, `aspect-3/4`, and `aspect-[7/9]` for `aspect-ratio`. SOURCE: https://tailwindcss.com/docs/adding-custom-styles LANGUAGE: CSS CODE: ``` @utility aspect-* { aspect-ratio: --value(--aspect-ratio-*, ratio, [ratio]);} ``` ---------------------------------------- TITLE: Apply Arbitrary Container Query Values in Tailwind CSS HTML DESCRIPTION: Demonstrates the use of arbitrary values for one-off container query sizes in Tailwind CSS. This allows defining custom min-width or max-width breakpoints directly in HTML without modifying the theme, useful for unique styling requirements. SOURCE: https://tailwindcss.com/docs/responsive-design LANGUAGE: HTML CODE: ``` <div class="@container"> <div class="flex flex-col @min-[475px]:flex-row"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: Apply Responsive Flex Utility with Breakpoints in Tailwind CSS DESCRIPTION: This HTML snippet shows how to apply a flex utility responsively using Tailwind CSS breakpoint variants. The `md:flex-1` class ensures that the `flex-1` utility is only active at medium screen sizes and above, while `flex-none` applies by default. SOURCE: https://tailwindcss.com/docs/flex LANGUAGE: HTML CODE: ``` <div class="flex-none md:flex-1 ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Defining Custom Responsive Breakpoint Theme Variable and Usage in HTML DESCRIPTION: This snippet demonstrates how to define a custom responsive breakpoint (`--breakpoint-3xl`) using the `@theme` directive in `app.css`. This custom breakpoint then enables a new `3xl:` variant, allowing utilities like `grid-cols-6` to be applied conditionally when the viewport exceeds the defined width. SOURCE: https://tailwindcss.com/docs/theme LANGUAGE: CSS CODE: ``` @import "tailwindcss"; @theme { --breakpoint-3xl: 120rem;} ``` LANGUAGE: HTML CODE: ``` <div class="3xl:grid-cols-6 grid grid-cols-2 md:grid-cols-4"> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Arbitrary Group Variants DESCRIPTION: Illustrates the use of arbitrary values within `group-*` variants to create one-off group selectors. This allows for dynamic and highly specific styling rules based on custom conditions, such as `group-[.is-published]:block`, providing flexibility beyond predefined utility classes. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div class="group is-published"> <div class="hidden group-[.is-published]:block"> Published </div></div> ``` ---------------------------------------- TITLE: Apply Tailwind CSS Isolate Utility to an Element DESCRIPTION: Demonstrates the basic usage of the `isolate` utility class in HTML to explicitly create a new stacking context for a `div` element. SOURCE: https://tailwindcss.com/docs/isolation LANGUAGE: HTML CODE: ``` <div class="isolate ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Apply Responsive Backface Visibility with Tailwind CSS DESCRIPTION: This snippet demonstrates how to use Tailwind CSS breakpoint variants to apply `backface-visibility` utilities responsively. The `md:backface-hidden` class ensures that `backface-hidden` is applied only at medium screen sizes and above, overriding the default `backface-visible`. SOURCE: https://tailwindcss.com/docs/backface-visibility LANGUAGE: HTML CODE: ``` <div class="backface-visible md:backface-hidden ..."> <!-- ... --></div> ``` ---------------------------------------- TITLE: Tailwind CSS Implicit Group Styling with in-* Variant DESCRIPTION: Explains the `in-*` variant, which allows styling based on parent state without explicitly adding `group` to the parent. It responds to state changes in *any* parent, offering a simpler but less granular alternative to `group` for general parent-child interactions. SOURCE: https://tailwindcss.com/docs/hover-focus-and-other-states LANGUAGE: HTML CODE: ``` <div tabindex="0" class="group"> <div class="opacity-50 group-focus:opacity-100"><div tabindex="0"> <div class="opacity-50 in-focus:opacity-100"> <!-- ... --> </div></div> ``` ---------------------------------------- TITLE: React Component for Conditional Layout Styling DESCRIPTION: Demonstrates a React component (`Example`) that conditionally applies `grid` or `flex` classes based on a prop. This is a recommended approach to programmatically manage styles and avoid directly applying conflicting utility classes to an element. SOURCE: https://tailwindcss.com/docs/styling-with-utility-classes LANGUAGE: JavaScript CODE: ``` export function Example({ gridLayout }) { return <div className={gridLayout ? "grid" : "flex"}>{/* ... */}</div>; } ``` ---------------------------------------- TITLE: Import Application Stylesheet in SvelteKit Layout DESCRIPTION: Svelte component code for `src/routes/+layout.svelte` to import the `app.css` file, ensuring Tailwind CSS styles are applied globally across the SvelteKit application. SOURCE: https://tailwindcss.com/docs/installation/framework-guides/sveltekit LANGUAGE: HTML CODE: ``` <script> let { children } = $props(); import "../app.css"; </script> {@render children()} ``` ---------------------------------------- TITLE: Apply break-after-column for Layout Control in HTML DESCRIPTION: Demonstrates how to use the `break-after-column` utility class within an HTML structure to force a column break after a specific paragraph in a multi-column layout. This ensures content flows into the next column at the desired point. SOURCE: https://tailwindcss.com/docs/break-after LANGUAGE: HTML CODE: ``` <div class="columns-2"> <p>Well, let me tell you something, ...</p> <p class="break-after-column">Sure, go ahead, laugh...</p> <p>Maybe we can live without...</p> <p>Look. If you think this is...</p> </div> ``` |