[{"data":1,"prerenderedAt":1416},["ShallowReactive",2],{"post-\u002Fblog\u002Fmodern-css-styling-approaches":3,"all-posts-nav":1185,"prosea-live-blog-paths":1390},{"id":4,"title":5,"body":6,"createdAt":1170,"description":1171,"extension":1172,"meta":1173,"navigation":255,"path":1174,"publishAt":1175,"seo":1176,"status":1177,"stem":1178,"tags":1179,"thumbnail":1183,"updatedAt":1175,"__hash__":1184,"_path":1174},"blog\u002Fblog\u002Fmodern-css-styling-approaches.md","Modern CSS Styling Approaches",{"type":7,"value":8,"toc":1157},"minimark",[9,18,21,26,31,34,38,41,45,63,66,70,73,78,88,91,142,197,204,305,308,312,323,449,456,463,467,470,559,562,566,575,600,603,640,650,654,663,722,729,912,915,919,926,1016,1019,1023,1031,1086,1089,1093,1096,1126,1129,1141,1154],[10,11,12,13,17],"p",{},"CSS has come a long way since I started web development. Back then, I'd have one massive ",[14,15,16],"code",{},"styles.css"," file for an entire site. Making changes felt like playing Jenga - change one thing and something completely unrelated would break. Sound familiar?",[10,19,20],{},"Let me walk you through how CSS styling has evolved and share what I've learned about each approach.",[22,23,25],"h2",{"id":24},"how-we-got-here","How We Got Here",[27,28,30],"h4",{"id":29},"the-global-stylesheet-era","The Global Stylesheet Era",[10,32,33],{},"My first projects used a single stylesheet for everything. Simple sites? Fine. Anything larger? Chaos. Every style lived in the global scope, classes conflicted constantly, and specificity wars were a daily occurrence.",[27,35,37],{"id":36},"independent-style-files","Independent Style Files",[10,39,40],{},"Things got slightly better when I started splitting CSS into separate files - one per page or component. Better organization, sure, but styles could still leak and conflict. I'd spend way too much time debugging why a button on page A looked broken because of CSS from page B.",[27,42,44],{"id":43},"global-utility-classes","Global Utility Classes",[10,46,47,48,51,52,51,55,58,59,62],{},"Then came the phase where everyone used utility classes like ",[14,49,50],{},".btn",", ",[14,53,54],{},".text-center",[14,56,57],{},".margin-10",". Reusable styles sounded great in theory. In practice? You'd end up with hundreds of custom classes, and no one could remember what ",[14,60,61],{},".helper-3"," actually did without checking the stylesheet.",[10,64,65],{},"The mental overhead was real. Large projects with tons of custom global classes became impossible to work with. You'd be afraid to add new styles because you might accidentally override something important.",[22,67,69],{"id":68},"modern-approaches-that-actually-work","Modern Approaches That Actually Work",[10,71,72],{},"The options available now are far better than what we had. Here's what I use now and why.",[74,75,77],"h3",{"id":76},"css-modules-scoping-done-right","CSS Modules - Scoping Done Right",[10,79,80,87],{},[81,82,86],"a",{"href":83,"rel":84},"https:\u002F\u002Fgithub.com\u002Fcss-modules\u002Fcss-modules",[85],"nofollow","CSS Modules"," solved the global namespace problem. Styles are locally scoped by default, which means classes in one component can't affect another.",[10,89,90],{},"In React, it looks like this:",[92,93,98],"pre",{"className":94,"code":95,"language":96,"meta":97,"style":97},"language-css shiki shiki-themes github-dark","\u002F* Button.module.css *\u002F\n.button {\n  background-color: blue;\n}\n","css","",[14,99,100,109,120,136],{"__ignoreMap":97},[101,102,105],"span",{"class":103,"line":104},"line",1,[101,106,108],{"class":107},"sAwPA","\u002F* Button.module.css *\u002F\n",[101,110,112,116],{"class":103,"line":111},2,[101,113,115],{"class":114},"svObZ",".button",[101,117,119],{"class":118},"s95oV"," {\n",[101,121,123,127,130,133],{"class":103,"line":122},3,[101,124,126],{"class":125},"sDLfK","  background-color",[101,128,129],{"class":118},": ",[101,131,132],{"class":125},"blue",[101,134,135],{"class":118},";\n",[101,137,139],{"class":103,"line":138},4,[101,140,141],{"class":118},"}\n",[92,143,147],{"className":144,"code":145,"language":146,"meta":97,"style":97},"language-js shiki shiki-themes github-dark","import styles from '.\u002FButton.module.css'\n;\u003Cbutton className={styles.button}>Click Me\u003C\u002Fbutton>\n","js",[14,148,149,165],{"__ignoreMap":97},[101,150,151,155,158,161],{"class":103,"line":104},[101,152,154],{"class":153},"snl16","import",[101,156,157],{"class":118}," styles ",[101,159,160],{"class":153},"from",[101,162,164],{"class":163},"sU2Wk"," '.\u002FButton.module.css'\n",[101,166,167,170,173,176,179,182,185,188,191,194],{"class":103,"line":111},[101,168,169],{"class":118},";",[101,171,172],{"class":153},"\u003C",[101,174,175],{"class":118},"button className",[101,177,178],{"class":153},"=",[101,180,181],{"class":118},"{styles.button}",[101,183,184],{"class":153},">",[101,186,187],{"class":118},"Click Me",[101,189,190],{"class":153},"\u003C\u002F",[101,192,193],{"class":118},"button",[101,195,196],{"class":153},">\n",[10,198,199,200,203],{},"Vue has a similar pattern with the ",[14,201,202],{},"$style"," object:",[92,205,209],{"className":206,"code":207,"language":208,"meta":97,"style":97},"language-vue shiki shiki-themes github-dark","\u003Ctemplate>\n  \u003Cp :class=\"$style.red\">This should be red\u003C\u002Fp>\n\u003C\u002Ftemplate>\n\n\u003Cstyle module>\n.red {\n  color: red;\n}\n\u003C\u002Fstyle>\n","vue",[14,210,211,221,243,251,257,270,278,291,296],{"__ignoreMap":97},[101,212,213,215,219],{"class":103,"line":104},[101,214,172],{"class":118},[101,216,218],{"class":217},"s4JwU","template",[101,220,196],{"class":118},[101,222,223,226,228,231,233,236,239,241],{"class":103,"line":111},[101,224,225],{"class":118},"  \u003C",[101,227,10],{"class":217},[101,229,230],{"class":114}," :class",[101,232,178],{"class":118},[101,234,235],{"class":163},"\"$style.red\"",[101,237,238],{"class":118},">This should be red\u003C\u002F",[101,240,10],{"class":217},[101,242,196],{"class":118},[101,244,245,247,249],{"class":103,"line":122},[101,246,190],{"class":118},[101,248,218],{"class":217},[101,250,196],{"class":118},[101,252,253],{"class":103,"line":138},[101,254,256],{"emptyLinePlaceholder":255},true,"\n",[101,258,260,262,265,268],{"class":103,"line":259},5,[101,261,172],{"class":118},[101,263,264],{"class":217},"style",[101,266,267],{"class":114}," module",[101,269,196],{"class":118},[101,271,273,276],{"class":103,"line":272},6,[101,274,275],{"class":114},".red",[101,277,119],{"class":118},[101,279,281,284,286,289],{"class":103,"line":280},7,[101,282,283],{"class":125},"  color",[101,285,129],{"class":118},[101,287,288],{"class":125},"red",[101,290,135],{"class":118},[101,292,294],{"class":103,"line":293},8,[101,295,141],{"class":118},[101,297,299,301,303],{"class":103,"line":298},9,[101,300,190],{"class":118},[101,302,264],{"class":217},[101,304,196],{"class":118},[10,306,307],{},"No more worrying about class name conflicts. Game changer.",[74,309,311],{"id":310},"scoped-styles-in-vuenuxt","Scoped Styles in Vue\u002FNuxt",[10,313,314,315,318,319,322],{},"Vue's ",[14,316,317],{},"\u003Cstyle scoped>"," is one of my favorite features. Add ",[14,320,321],{},"scoped"," to your style tag and Vue automatically generates unique data attributes to isolate your styles:",[92,324,326],{"className":206,"code":325,"language":208,"meta":97,"style":97},"\u003Ctemplate>\n  \u003Cdiv class=\"example\">Scoped styles only apply here.\u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n\n\u003Cstyle scoped>\n.example {\n  font-size: 1.5rem;\n  background-color: #242424;\n  border: 1px solid white;\n}\n\u003C\u002Fstyle>\n",[14,327,328,336,358,366,370,381,388,403,414,435,440],{"__ignoreMap":97},[101,329,330,332,334],{"class":103,"line":104},[101,331,172],{"class":118},[101,333,218],{"class":217},[101,335,196],{"class":118},[101,337,338,340,343,346,348,351,354,356],{"class":103,"line":111},[101,339,225],{"class":118},[101,341,342],{"class":217},"div",[101,344,345],{"class":114}," class",[101,347,178],{"class":118},[101,349,350],{"class":163},"\"example\"",[101,352,353],{"class":118},">Scoped styles only apply here.\u003C\u002F",[101,355,342],{"class":217},[101,357,196],{"class":118},[101,359,360,362,364],{"class":103,"line":122},[101,361,190],{"class":118},[101,363,218],{"class":217},[101,365,196],{"class":118},[101,367,368],{"class":103,"line":138},[101,369,256],{"emptyLinePlaceholder":255},[101,371,372,374,376,379],{"class":103,"line":259},[101,373,172],{"class":118},[101,375,264],{"class":217},[101,377,378],{"class":114}," scoped",[101,380,196],{"class":118},[101,382,383,386],{"class":103,"line":272},[101,384,385],{"class":114},".example",[101,387,119],{"class":118},[101,389,390,393,395,398,401],{"class":103,"line":280},[101,391,392],{"class":125},"  font-size",[101,394,129],{"class":118},[101,396,397],{"class":125},"1.5",[101,399,400],{"class":153},"rem",[101,402,135],{"class":118},[101,404,405,407,409,412],{"class":103,"line":293},[101,406,126],{"class":125},[101,408,129],{"class":118},[101,410,411],{"class":125},"#242424",[101,413,135],{"class":118},[101,415,416,419,421,424,427,430,433],{"class":103,"line":298},[101,417,418],{"class":125},"  border",[101,420,129],{"class":118},[101,422,423],{"class":125},"1",[101,425,426],{"class":153},"px",[101,428,429],{"class":125}," solid",[101,431,432],{"class":125}," white",[101,434,135],{"class":118},[101,436,438],{"class":103,"line":437},10,[101,439,141],{"class":118},[101,441,443,445,447],{"class":103,"line":442},11,[101,444,190],{"class":118},[101,446,264],{"class":217},[101,448,196],{"class":118},[10,450,451,452,455],{},"Under the hood, Vue generates something like ",[14,453,454],{},".example[data-v-f137c5cf]"," - unique to that component. Your styles stay contained, and you can use simple class names without fear.",[10,457,458,459,462],{},"This is similar to localized ",[14,460,461],{},"\u003Cstyle>"," tags in raw HTML, but automated. Speaking of which...",[74,464,466],{"id":465},"localized-style-tags-in-html","Localized Style Tags in HTML",[10,468,469],{},"Before frameworks, you could manually scope styles using IDs or unique classes:",[92,471,475],{"className":472,"code":473,"language":474,"meta":97,"style":97},"language-html shiki shiki-themes github-dark","\u003Csection id=\"special-section\">\n  \u003Cstyle>\n    #special-section h2 {\n      color: green;\n    }\n  \u003C\u002Fstyle>\n  \u003Ch2>Styled Heading in Special Section\u003C\u002Fh2>\n\u003C\u002Fsection>\n","html",[14,476,477,494,502,512,524,529,538,551],{"__ignoreMap":97},[101,478,479,481,484,487,489,492],{"class":103,"line":104},[101,480,172],{"class":118},[101,482,483],{"class":217},"section",[101,485,486],{"class":114}," id",[101,488,178],{"class":118},[101,490,491],{"class":163},"\"special-section\"",[101,493,196],{"class":118},[101,495,496,498,500],{"class":103,"line":111},[101,497,225],{"class":118},[101,499,264],{"class":217},[101,501,196],{"class":118},[101,503,504,507,510],{"class":103,"line":122},[101,505,506],{"class":114},"    #special-section",[101,508,509],{"class":217}," h2",[101,511,119],{"class":118},[101,513,514,517,519,522],{"class":103,"line":138},[101,515,516],{"class":125},"      color",[101,518,129],{"class":118},[101,520,521],{"class":125},"green",[101,523,135],{"class":118},[101,525,526],{"class":103,"line":259},[101,527,528],{"class":118},"    }\n",[101,530,531,534,536],{"class":103,"line":272},[101,532,533],{"class":118},"  \u003C\u002F",[101,535,264],{"class":217},[101,537,196],{"class":118},[101,539,540,542,544,547,549],{"class":103,"line":280},[101,541,225],{"class":118},[101,543,22],{"class":217},[101,545,546],{"class":118},">Styled Heading in Special Section\u003C\u002F",[101,548,22],{"class":217},[101,550,196],{"class":118},[101,552,553,555,557],{"class":103,"line":293},[101,554,190],{"class":118},[101,556,483],{"class":217},[101,558,196],{"class":118},[10,560,561],{},"It works, but it's tedious to maintain. This is why I love framework solutions - they automate this pattern.",[74,563,565],{"id":564},"atomic-css-my-current-go-to","Atomic CSS - My Current Go-To",[10,567,568,569,574],{},"I was skeptical about ",[81,570,573],{"href":571,"rel":572},"https:\u002F\u002Ftailwindcss.com\u002F",[85],"Tailwind CSS"," at first. Utility classes everywhere? Seemed messy. Then I used it on a project and completely changed my mind.",[92,576,578],{"className":472,"code":577,"language":474,"meta":97,"style":97},"\u003Cbutton class=\"bg-blue rounded p-2 text-white\">Click Me\u003C\u002Fbutton>\n",[14,579,580],{"__ignoreMap":97},[101,581,582,584,586,588,590,593,596,598],{"class":103,"line":104},[101,583,172],{"class":118},[101,585,193],{"class":217},[101,587,345],{"class":114},[101,589,178],{"class":118},[101,591,592],{"class":163},"\"bg-blue rounded p-2 text-white\"",[101,594,595],{"class":118},">Click Me\u003C\u002F",[101,597,193],{"class":217},[101,599,196],{"class":118},[10,601,602],{},"Here's why it clicked for me:",[604,605,606,614,628,634],"ol",{},[607,608,609,613],"li",{},[610,611,612],"strong",{},"No context switching"," - I stay in my HTML\u002FJSX instead of jumping between files",[607,615,616,619,620,623,624,627],{},[610,617,618],{},"Predictable naming"," - ",[14,621,622],{},"p-4"," means padding, ",[14,625,626],{},"bg-blue"," means blue background. No guessing.",[607,629,630,633],{},[610,631,632],{},"Less CSS to maintain"," - My stylesheets are tiny because I'm reusing atomic utilities",[607,635,636,639],{},[610,637,638],{},"Rapid prototyping"," - I can build and iterate on UI incredibly fast",[10,641,642,643,646,647,649],{},"The key difference from custom utility classes? Tailwind's utilities are standardized and self-documenting. Everyone knows what ",[14,644,645],{},"text-center"," does. Good luck remembering what ",[14,648,61],{}," was supposed to do.",[74,651,653],{"id":652},"css-in-js-when-you-need-dynamic-styles","CSS-in-JS - When You Need Dynamic Styles",[10,655,656,657,662],{},"For components with state-dependent styling, CSS-in-JS libraries like ",[81,658,661],{"href":659,"rel":660},"https:\u002F\u002Fstyled-components.com\u002F",[85],"Styled Components"," are powerful:",[92,664,666],{"className":144,"code":665,"language":146,"meta":97,"style":97},"import styled from 'styled-components'\n\nconst Button = styled.button`\n  background-color: blue;\n  color: white;\n  padding: 10px;\n`\n",[14,667,668,680,684,703,708,713,718],{"__ignoreMap":97},[101,669,670,672,675,677],{"class":103,"line":104},[101,671,154],{"class":153},[101,673,674],{"class":118}," styled ",[101,676,160],{"class":153},[101,678,679],{"class":163}," 'styled-components'\n",[101,681,682],{"class":103,"line":111},[101,683,256],{"emptyLinePlaceholder":255},[101,685,686,689,692,695,698,700],{"class":103,"line":122},[101,687,688],{"class":153},"const",[101,690,691],{"class":125}," Button",[101,693,694],{"class":153}," =",[101,696,697],{"class":118}," styled.",[101,699,193],{"class":114},[101,701,702],{"class":163},"`\n",[101,704,705],{"class":103,"line":138},[101,706,707],{"class":163},"  background-color: blue;\n",[101,709,710],{"class":103,"line":259},[101,711,712],{"class":163},"  color: white;\n",[101,714,715],{"class":103,"line":272},[101,716,717],{"class":163},"  padding: 10px;\n",[101,719,720],{"class":103,"line":280},[101,721,702],{"class":163},[10,723,724,725,728],{},"In Vue, you can achieve similar results with ",[14,726,727],{},":style"," bindings and computed properties:",[92,730,732],{"className":206,"code":731,"language":208,"meta":97,"style":97},"\u003Ctemplate>\n  \u003Cdiv :style=\"computedStyles\">\n    \u003Cslot \u002F>\n  \u003C\u002Fdiv>\n\u003C\u002Ftemplate>\n\n\u003Cscript>\nexport default {\n  props: {\n    padding: {\n      type: String,\n      default: '8px'\n    }\n  },\n  computed: {\n    computedStyles() {\n      return {\n        padding: this.padding\n      }\n    }\n  }\n}\n\u003C\u002Fscript>\n",[14,733,734,742,758,772,780,788,792,801,811,816,821,826,835,840,846,852,861,869,881,887,892,898,903],{"__ignoreMap":97},[101,735,736,738,740],{"class":103,"line":104},[101,737,172],{"class":118},[101,739,218],{"class":217},[101,741,196],{"class":118},[101,743,744,746,748,751,753,756],{"class":103,"line":111},[101,745,225],{"class":118},[101,747,342],{"class":217},[101,749,750],{"class":114}," :style",[101,752,178],{"class":118},[101,754,755],{"class":163},"\"computedStyles\"",[101,757,196],{"class":118},[101,759,760,763,766,770],{"class":103,"line":122},[101,761,762],{"class":118},"    \u003C",[101,764,765],{"class":217},"slot",[101,767,769],{"class":768},"s6RL2"," \u002F",[101,771,196],{"class":118},[101,773,774,776,778],{"class":103,"line":138},[101,775,533],{"class":118},[101,777,342],{"class":217},[101,779,196],{"class":118},[101,781,782,784,786],{"class":103,"line":259},[101,783,190],{"class":118},[101,785,218],{"class":217},[101,787,196],{"class":118},[101,789,790],{"class":103,"line":272},[101,791,256],{"emptyLinePlaceholder":255},[101,793,794,796,799],{"class":103,"line":280},[101,795,172],{"class":118},[101,797,798],{"class":217},"script",[101,800,196],{"class":118},[101,802,803,806,809],{"class":103,"line":293},[101,804,805],{"class":153},"export",[101,807,808],{"class":153}," default",[101,810,119],{"class":118},[101,812,813],{"class":103,"line":298},[101,814,815],{"class":118},"  props: {\n",[101,817,818],{"class":103,"line":437},[101,819,820],{"class":118},"    padding: {\n",[101,822,823],{"class":103,"line":442},[101,824,825],{"class":118},"      type: String,\n",[101,827,829,832],{"class":103,"line":828},12,[101,830,831],{"class":118},"      default: ",[101,833,834],{"class":163},"'8px'\n",[101,836,838],{"class":103,"line":837},13,[101,839,528],{"class":118},[101,841,843],{"class":103,"line":842},14,[101,844,845],{"class":118},"  },\n",[101,847,849],{"class":103,"line":848},15,[101,850,851],{"class":118},"  computed: {\n",[101,853,855,858],{"class":103,"line":854},16,[101,856,857],{"class":114},"    computedStyles",[101,859,860],{"class":118},"() {\n",[101,862,864,867],{"class":103,"line":863},17,[101,865,866],{"class":153},"      return",[101,868,119],{"class":118},[101,870,872,875,878],{"class":103,"line":871},18,[101,873,874],{"class":118},"        padding: ",[101,876,877],{"class":125},"this",[101,879,880],{"class":118},".padding\n",[101,882,884],{"class":103,"line":883},19,[101,885,886],{"class":118},"      }\n",[101,888,890],{"class":103,"line":889},20,[101,891,528],{"class":118},[101,893,895],{"class":103,"line":894},21,[101,896,897],{"class":118},"  }\n",[101,899,901],{"class":103,"line":900},22,[101,902,141],{"class":118},[101,904,906,908,910],{"class":103,"line":905},23,[101,907,190],{"class":118},[101,909,798],{"class":217},[101,911,196],{"class":118},[10,913,914],{},"This approach shines when you need styles that change based on props or state.",[74,916,918],{"id":917},"css-variables-the-unsung-hero","CSS Variables - The Unsung Hero",[10,920,921,922,925],{},"CSS variables (custom properties) don't get enough love. Define them once at the ",[14,923,924],{},":root"," level and use them everywhere:",[92,927,929],{"className":94,"code":928,"language":96,"meta":97,"style":97},":root {\n  --color-primary: #007bff;\n  --spacing-base: 16px;\n}\n\n.button {\n  background-color: var(--color-primary);\n  padding: var(--spacing-base);\n}\n",[14,930,931,937,950,964,968,972,978,996,1012],{"__ignoreMap":97},[101,932,933,935],{"class":103,"line":104},[101,934,924],{"class":114},[101,936,119],{"class":118},[101,938,939,943,945,948],{"class":103,"line":111},[101,940,942],{"class":941},"s9osk","  --color-primary",[101,944,129],{"class":118},[101,946,947],{"class":125},"#007bff",[101,949,135],{"class":118},[101,951,952,955,957,960,962],{"class":103,"line":122},[101,953,954],{"class":941},"  --spacing-base",[101,956,129],{"class":118},[101,958,959],{"class":125},"16",[101,961,426],{"class":153},[101,963,135],{"class":118},[101,965,966],{"class":103,"line":138},[101,967,141],{"class":118},[101,969,970],{"class":103,"line":259},[101,971,256],{"emptyLinePlaceholder":255},[101,973,974,976],{"class":103,"line":272},[101,975,115],{"class":114},[101,977,119],{"class":118},[101,979,980,982,984,987,990,993],{"class":103,"line":280},[101,981,126],{"class":125},[101,983,129],{"class":118},[101,985,986],{"class":125},"var",[101,988,989],{"class":118},"(",[101,991,992],{"class":941},"--color-primary",[101,994,995],{"class":118},");\n",[101,997,998,1001,1003,1005,1007,1010],{"class":103,"line":293},[101,999,1000],{"class":125},"  padding",[101,1002,129],{"class":118},[101,1004,986],{"class":125},[101,1006,989],{"class":118},[101,1008,1009],{"class":941},"--spacing-base",[101,1011,995],{"class":118},[101,1013,1014],{"class":103,"line":298},[101,1015,141],{"class":118},[10,1017,1018],{},"I use these for theming all the time. Want to support light and dark modes? Just swap out the variable values. No need to rewrite a ton of CSS.",[74,1020,1022],{"id":1021},"bem-still-relevant","BEM - Still Relevant",[10,1024,1025,1030],{},[81,1026,1029],{"href":1027,"rel":1028},"https:\u002F\u002Fgetbem.com\u002F",[85],"BEM (Block Element Modifier)"," isn't dead. When I'm not using a framework or utility classes, BEM keeps my CSS organized and predictable:",[92,1032,1036],{"className":1033,"code":1034,"language":1035,"meta":97,"style":97},"language-scss shiki shiki-themes github-dark",".button--primary {\n  \u002F* primary button *\u002F\n}\n.button--secondary {\n  \u002F* secondary button *\u002F\n}\n.button__icon {\n  \u002F* icon inside button *\u002F\n}\n","scss",[14,1037,1038,1045,1050,1054,1061,1066,1070,1077,1082],{"__ignoreMap":97},[101,1039,1040,1043],{"class":103,"line":104},[101,1041,1042],{"class":114},".button--primary",[101,1044,119],{"class":118},[101,1046,1047],{"class":103,"line":111},[101,1048,1049],{"class":107},"  \u002F* primary button *\u002F\n",[101,1051,1052],{"class":103,"line":122},[101,1053,141],{"class":118},[101,1055,1056,1059],{"class":103,"line":138},[101,1057,1058],{"class":114},".button--secondary",[101,1060,119],{"class":118},[101,1062,1063],{"class":103,"line":259},[101,1064,1065],{"class":107},"  \u002F* secondary button *\u002F\n",[101,1067,1068],{"class":103,"line":272},[101,1069,141],{"class":118},[101,1071,1072,1075],{"class":103,"line":280},[101,1073,1074],{"class":114},".button__icon",[101,1076,119],{"class":118},[101,1078,1079],{"class":103,"line":293},[101,1080,1081],{"class":107},"  \u002F* icon inside button *\u002F\n",[101,1083,1084],{"class":103,"line":298},[101,1085,141],{"class":118},[10,1087,1088],{},"The naming convention makes relationships clear. It's verbose but explicit.",[22,1090,1092],{"id":1091},"what-i-recommend","What I Recommend",[10,1094,1095],{},"After working with all these approaches, here's what I reach for:",[604,1097,1098,1104,1114,1120],{},[607,1099,1100,1103],{},[610,1101,1102],{},"Utility-first CSS (Tailwind)"," for most projects - Fast development, minimal CSS to maintain",[607,1105,1106,1109,1110,1113],{},[610,1107,1108],{},"Scoped styles (Vue)"," or ",[610,1111,1112],{},"CSS Modules (React)"," when I need component-specific styles that don't fit utilities",[607,1115,1116,1119],{},[610,1117,1118],{},"CSS variables"," for theming and design tokens",[607,1121,1122,1125],{},[610,1123,1124],{},"CSS-in-JS"," only when I need highly dynamic, state-dependent styling",[10,1127,1128],{},"Start with what solves your immediate pain point. For me, the biggest wins came from:",[1130,1131,1132,1135,1138],"ul",{},[607,1133,1134],{},"Eliminating global CSS conflicts (scoped styles\u002FCSS Modules)",[607,1136,1137],{},"Reducing the mental overhead of custom classes (Tailwind)",[607,1139,1140],{},"Making theming trivial (CSS variables)",[10,1142,1143,1144,1148,1149,1153],{},"Modern CSS is less about picking \"the right way\" and more about combining tools that make sense for your project. The goal is spending less time fighting CSS and more time building features. I go deeper into the problems with custom global classes in ",[81,1145,1147],{"href":1146},"\u002Fblog\u002Freducing-mental-overhead-css\u002F","reducing the mental overhead of CSS",", and I wrote about ",[81,1150,1152],{"href":1151},"\u002Fblog\u002Fwhy-tailwind-css-every-project\u002F","why I now use Tailwind on every project"," after trying most of these approaches in production.",[264,1155,1156],{},"html pre.shiki code .sAwPA, html code.shiki .sAwPA{--shiki-default:#6A737D}html pre.shiki code .svObZ, html code.shiki .svObZ{--shiki-default:#B392F0}html pre.shiki code .s95oV, html code.shiki .s95oV{--shiki-default:#E1E4E8}html pre.shiki code .sDLfK, html code.shiki .sDLfK{--shiki-default:#79B8FF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html pre.shiki code .snl16, html code.shiki .snl16{--shiki-default:#F97583}html pre.shiki code .sU2Wk, html code.shiki .sU2Wk{--shiki-default:#9ECBFF}html pre.shiki code .s4JwU, html code.shiki .s4JwU{--shiki-default:#85E89D}html pre.shiki code .s6RL2, html code.shiki .s6RL2{--shiki-default:#FDAEB7;--shiki-default-font-style:italic}html pre.shiki code .s9osk, html code.shiki .s9osk{--shiki-default:#FFAB70}",{"title":97,"searchDepth":111,"depth":111,"links":1158},[1159,1160,1169],{"id":24,"depth":111,"text":25},{"id":68,"depth":111,"text":69,"children":1161},[1162,1163,1164,1165,1166,1167,1168],{"id":76,"depth":122,"text":77},{"id":310,"depth":122,"text":311},{"id":465,"depth":122,"text":466},{"id":564,"depth":122,"text":565},{"id":652,"depth":122,"text":653},{"id":917,"depth":122,"text":918},{"id":1021,"depth":122,"text":1022},{"id":1091,"depth":111,"text":1092},"2024-11-03","Remember having one massive styles.css file for an entire site? I don't miss that. Here's how CSS styling has changed and what I actually use now.","md",{},"\u002Fblog\u002Fmodern-css-styling-approaches",null,{"title":5,"description":1171},"published","blog\u002Fmodern-css-styling-approaches",[96,1180,1181,1182],"styling","frontend","ui","\u002Fblog\u002Fmodern-css-styling.webp","960NrV0I94pCPo0J2EkbaHejl0PgQdNBAB3xOZzpTY8",[1186,1197,1207,1215,1222,1230,1241,1251,1261,1268,1274,1281,1291,1299,1307,1313,1315,1322,1328,1337,1344,1353,1361,1368,1377,1383],{"path":1187,"title":1188,"description":1189,"createdAt":1190,"thumbnail":1191,"tags":1192,"status":1177,"publishAt":1190,"_path":1187},"\u002Fblog\u002Fhow-i-work-async-remote","How I work async and remote-first: specs, workstreams, Loom over Zoom","How I run remote client engagements as a freelance developer. Written specs, workstreams, Loom over meetings, and the Rework and Remote (Basecamp) influence behind it.","2026-05-29","\u002Fblog\u002Fclaude-code-workflow.webp",[1193,1194,1195,1196],"workflow","remote","freelance","communication",{"path":1198,"title":1199,"description":1200,"createdAt":1201,"thumbnail":1191,"tags":1202,"status":1177,"publishAt":1175,"_path":1198},"\u002Fblog\u002Fai-dev-workflow-timeline","My AI dev workflow timeline — from cancelling Cursor to multi-model routing","A chronology of how I started using Claude Code: cancelling Cursor in December 2024, discovering it through TLDR, and what eleven months of daily use turned the workflow into.","2026-05-16",[1203,1204,1205,1206],"ai","productivity","tooling","developer-experience",{"path":1208,"title":1209,"description":1210,"createdAt":1211,"thumbnail":1212,"tags":1213,"status":1177,"publishAt":1175,"_path":1208},"\u002Fblog\u002Fai-coding-agents-pr-level","PR-level AI agents: Copilot, Claude, and Gemini in your GitHub workflow","Extending my AI coding workflow with GitHub PR agents. When to use @copilot vs @claude vs @gemini, and how they fit into a multi-layer development stack.","2026-02-19","\u002Fblog\u002Fai-coding-agents-pr-level.webp",[1203,1204,1205,1206,1214],"github",{"path":1216,"title":1217,"description":1218,"createdAt":1211,"thumbnail":1219,"tags":1220,"status":1177,"publishAt":1175,"_path":1216},"\u002Fblog\u002Fai-coding-editors","Editor-level AI: completions, agents, and the Zed setup I actually use","The middle layer of AI coding tools. Inline completions, agent panels, and external agents like Claude Code running inside your editor.","\u002Fblog\u002Fai-coding-editors.webp",[1203,1204,1205,1206,1221],"zed",{"path":1223,"title":1224,"description":1225,"createdAt":1211,"thumbnail":1226,"tags":1227,"status":1177,"publishAt":1175,"_path":1223},"\u002Fblog\u002Fclawdbot-vps-setup","Setting Up a Persistent AI Agent on a VPS with OpenClaw","How to run OpenClaw on a DigitalOcean VPS, lock it down with Tailscale, and sync everything to Obsidian with Syncthing.","\u002Fblog\u002Fclawdbot-vps-setup.webp",[1203,1204,1205,1206,1228,1229],"devops","openclaw",{"path":1231,"title":1232,"description":1233,"createdAt":1234,"thumbnail":1235,"tags":1236,"status":1177,"publishAt":1175,"_path":1231},"\u002Fblog\u002Ftrue-cost-technical-debt","The True Cost of Technical Debt: When 'Good Enough' Becomes Expensive","That quick fix from two years ago is now costing you hours every week. Here's how technical debt accumulates and when it makes sense to pay it down.","2026-01-29","\u002Fblog\u002Ftechnical-debt.webp",[1237,1238,1239,1240],"technical-debt","maintenance","business","refactoring",{"path":1242,"title":1243,"description":1244,"createdAt":1245,"thumbnail":1246,"tags":1247,"status":1177,"publishAt":1175,"_path":1242},"\u002Fblog\u002Flead-generation-websites-convert","Lead Generation Websites That Actually Convert","Most lead gen sites are slow, confusing, or ask for too much too soon. Here's what makes the difference between a site that generates leads and one that just exists.","2026-01-27","\u002Fblog\u002Flead-generation-websites.webp",[1248,1249,1250,1239],"lead-generation","conversion","performance",{"path":1252,"title":1253,"description":1254,"createdAt":1255,"thumbnail":1256,"tags":1257,"status":1177,"publishAt":1175,"_path":1252},"\u002Fblog\u002Fhiring-web-developer-guide","What Business Owners Should Know Before Hiring a Web Developer","Questions to ask, red flags to watch for, and how to tell if someone actually knows what they're doing. A practical guide from the other side of the table.","2026-01-25","\u002Fblog\u002Fhiring-web-developer-guide.webp",[1239,1195,1258,1259,1260],"web-development","wordpress","hiring",{"path":1262,"title":1263,"description":1264,"createdAt":1265,"thumbnail":1266,"tags":1267,"status":1177,"publishAt":1175,"_path":1262},"\u002Fblog\u002Fwordpress-site-losing-money","Why Your WordPress Site Is Losing You Money","That 6-second load time isn't just annoying - it's costing you customers. Here's what's actually wrong with most WordPress sites and how to fix it.","2026-01-23","\u002Fblog\u002Fwordpress-site-losing-money.webp",[1259,1250,1239],{"path":1269,"title":1270,"description":1271,"createdAt":1272,"thumbnail":1191,"tags":1273,"status":1177,"publishAt":1175,"_path":1269},"\u002Fblog\u002Fclaude-code-workflow","How I Use Claude Code to Ship Better Code Faster","My actual workflow with AI pair programming. Custom skills, autonomous agents, and the specific ways Claude Code has changed how I work.","2026-01-21",[1203,1204,1205,1206],{"path":1275,"title":1276,"description":1277,"createdAt":1272,"thumbnail":1278,"tags":1279,"status":1177,"publishAt":1175,"_path":1275},"\u002Fblog\u002Fobsidian-claude-code-workflow","My Developer Second Brain: Obsidian and Claude Code Together","How I combine Obsidian for knowledge capture with Claude Code for automation. The note structure, AI integration, and workflows that actually stick.","\u002Fblog\u002Fobsidian-claude-workflow.webp",[1204,1203,1280,1206],"obsidian",{"path":1282,"title":1283,"description":1284,"createdAt":1285,"thumbnail":1286,"tags":1287,"status":1177,"publishAt":1175,"_path":1282},"\u002Fblog\u002Fcloudflare-blocks-ai-bots","How Cloudflare Blocks AI Bots From Scraping Your Content","Cloudflare now lets you block AI bots like GPTBot, ClaudeBot, and others from scraping your site. Here's how it works and whether it actually matters.","2025-12-03","\u002Fblog\u002Fcloudflare-blocks-ai-bots.webp",[1288,1203,1289,1290],"cloudflare","security","web",{"path":1292,"title":1293,"description":1294,"createdAt":1295,"thumbnail":1296,"tags":1297,"status":1177,"publishAt":1175,"_path":1292},"\u002Fblog\u002Fimage-optimization-web-performance","Image Optimization for Web Performance","Shipping 5MB images to production? I've been there. Learn how to optimize images properly and why it matters more than you think for web performance.","2024-12-03","\u002Fblog\u002Fimage-optimization-performance.webp",[1250,1181,1298],"optimization",{"path":1300,"title":1301,"description":1302,"createdAt":1170,"thumbnail":1303,"tags":1304,"status":1177,"publishAt":1175,"_path":1300},"\u002Fblog\u002Fcomponent-driven-development-cdd","Component-driven development (CDD)","Stop building pages from scratch. Component-driven development changed how I build UIs - here's why it works and how to get started.","\u002Fblog\u002Fcomponent-driven-development.webp",[1181,208,1182,1305,1306],"components","storybook",{"path":1308,"title":1309,"description":1310,"createdAt":1170,"thumbnail":1311,"tags":1312,"status":1177,"publishAt":1175,"_path":1308},"\u002Fblog\u002Ffrontend-best-practices","Frontend best practices","I've shipped features fast only to struggle understanding my own code months later. Here's what I've learned about building frontend applications you'll actually enjoy maintaining.","\u002Fblog\u002Ffrontend-best-practices.webp",[1181,1182,1305],{"path":1174,"title":5,"description":1171,"createdAt":1170,"thumbnail":1183,"tags":1314,"status":1177,"publishAt":1175,"_path":1174},[96,1180,1181,1182],{"path":1316,"title":1317,"description":1318,"createdAt":1170,"thumbnail":1319,"tags":1320,"status":1177,"publishAt":1175,"_path":1316},"\u002Fblog\u002Foptimizing-assets-for-web-performance","Optimizing Assets for Maximum Web Performance","The worst performance culprits? Unoptimized images, bloated JavaScript bundles, and poor asset loading. Here's what actually makes a difference.","\u002Fblog\u002Foptimizing-web-assets-performance.webp",[1181,1321],"nuxt",{"path":1323,"title":1324,"description":1325,"createdAt":1170,"thumbnail":1326,"tags":1327,"status":1177,"publishAt":1175,"_path":1323},"\u002Fblog\u002Freducing-mental-overhead-css","Mental Overhead of Custom Global Classes in CSS","I've worked on projects with hundreds of custom CSS classes like .helper-12 and .util-spacing-3. Can you guess what they do? Neither could I.","\u002Fblog\u002Fcss-mental-overhead.webp",[96,1180,1181,1182],{"path":1329,"title":1330,"description":1331,"createdAt":1332,"thumbnail":1333,"tags":1334,"status":1177,"publishAt":1175,"_path":1329},"\u002Fblog\u002Fpath-environment-dotfiles-shell-config","The PATH Environment Variable, Dotfiles and Shell Configuration Files","I once spent two hours debugging why 'node' wouldn't run after installing it. Turns out my PATH was broken. Here's what I wish I'd known about shell configuration.","2024-08-27","\u002Fblog\u002Flaptop.jpeg",[1335,1336],"dotfiles","shell",{"path":1338,"title":1339,"description":1340,"createdAt":1341,"thumbnail":1342,"tags":1343,"status":1177,"publishAt":1175,"_path":1338},"\u002Fblog\u002Fmobile-first-design","Mobile-First Design For Enhanced Web Performance","Most web traffic is mobile now, but I still see projects building desktop-first. Here's why that approach kills performance.","2024-08-24","\u002Fblog\u002Fmobile-first-design.webp",[1181,1250],{"path":1345,"title":1346,"description":1347,"createdAt":1348,"thumbnail":1349,"tags":1350,"status":1177,"publishAt":1175,"_path":1345},"\u002Fblog\u002Fwebpack-modern-bundlers","It's time to leave webpack behind - modern bundlers are here","I spent three days fighting a webpack config file. Here's why I switched to Vite and esbuild, and why you should consider it too.","2024-08-16","\u002Fblog\u002Fwebpack.svg",[1181,1351,1352],"bundlers","tools",{"path":1354,"title":1355,"description":1356,"createdAt":1357,"thumbnail":1358,"tags":1359,"status":1177,"publishAt":1175,"_path":1354},"\u002Fblog\u002Fusing-axios-proxy-with-nuxt","Understanding axios proxy and getting it to work with nuxt.js","How to get axios to work with nuxt.js. Configure proxy settings when trying make axios requests in Nuxt.","2021-03-11","\u002Fblog\u002Fnuxt.svg",[1181,1360,1321],"axios",{"path":1362,"title":1363,"description":1364,"createdAt":1365,"thumbnail":1358,"tags":1366,"status":1177,"publishAt":1175,"_path":1362},"\u002Fblog\u002Fadding-images-with-nuxt-content","Adding Images To Markdown With Nuxt Content Module","How to add images to Nuxt Content blog posts using @nuxt\u002Fimage for automatic optimization and lazy loading.","2021-03-01",[1181,208,1321,1367],"images",{"path":1369,"title":1370,"description":1371,"createdAt":1372,"thumbnail":1373,"tags":1374,"status":1177,"publishAt":1175,"_path":1369},"\u002Fblog\u002Fpage-speed-load-time","How Page Speed & Load Time Impacts Conversions","Slow sites kill conversions. Here's what happens when users wait too long for your pages to load, and why page speed should be your top priority.","2020-12-22","\u002Fblog\u002Ffast_loading.svg",[1181,1375,1250,1376],"speed","conversions",{"path":1378,"title":1379,"description":1380,"createdAt":1381,"thumbnail":1373,"tags":1382,"status":1177,"publishAt":1175,"_path":1378},"\u002Fblog\u002Fsteps-to-improve-page-speed-load-time","Website Performance Optimization Strategies To Reduce Page Loading Speed","Every site owner thinks their site is fast enough. Then users bounce after 3 seconds. Here's what actually moves the needle on performance.","2020-12-20",[1181,1375,1298,1250],{"path":1384,"title":1385,"description":1386,"createdAt":1387,"thumbnail":1388,"tags":1389,"status":1177,"publishAt":1175,"_path":1384},"\u002Fblog\u002Fremote-working-productivity","Time Management When Working Remotely","I once spent an entire remote workday doing almost nothing productive. That's when I learned remote work requires a completely different approach to time management.","2019-11-03","\u002Fblog\u002Ftime_management.svg",[1204,1194],[1391,1392,1393,1394,1395,1396,1397,1398,1399,1400,1401,1402,1403,1404,1405,1406,1407,1408,1409,1146,1410,1411,1412,1413,1414,1415],"\u002Fblog\u002Fadding-images-with-nuxt-content\u002F","\u002Fblog\u002Fai-coding-agents-pr-level\u002F","\u002Fblog\u002Fai-coding-editors\u002F","\u002Fblog\u002Fai-dev-workflow-timeline\u002F","\u002Fblog\u002Fclaude-code-workflow\u002F","\u002Fblog\u002Fclawdbot-vps-setup\u002F","\u002Fblog\u002Fcloudflare-blocks-ai-bots\u002F","\u002Fblog\u002Fcomponent-driven-development-cdd\u002F","\u002Fblog\u002Ffrontend-best-practices\u002F","\u002Fblog\u002Fhiring-web-developer-guide\u002F","\u002Fblog\u002Fhow-i-work-async-remote\u002F","\u002Fblog\u002Fimage-optimization-web-performance\u002F","\u002Fblog\u002Flead-generation-websites-convert\u002F","\u002Fblog\u002Fmobile-first-design\u002F","\u002Fblog\u002Fmodern-css-styling-approaches\u002F","\u002Fblog\u002Fobsidian-claude-code-workflow\u002F","\u002Fblog\u002Foptimizing-assets-for-web-performance\u002F","\u002Fblog\u002Fpage-speed-load-time\u002F","\u002Fblog\u002Fpath-environment-dotfiles-shell-config\u002F","\u002Fblog\u002Fremote-working-productivity\u002F","\u002Fblog\u002Fsteps-to-improve-page-speed-load-time\u002F","\u002Fblog\u002Ftrue-cost-technical-debt\u002F","\u002Fblog\u002Fusing-axios-proxy-with-nuxt\u002F","\u002Fblog\u002Fwebpack-modern-bundlers\u002F","\u002Fblog\u002Fwordpress-site-losing-money\u002F",1795336811428]