{"id":2079,"date":"2025-04-27T01:53:04","date_gmt":"2025-04-27T01:53:04","guid":{"rendered":"https:\/\/appliedartand.design\/lj\/?p=2079"},"modified":"2025-04-27T01:53:04","modified_gmt":"2025-04-27T01:53:04","slug":"a-dash-of-sass","status":"publish","type":"post","link":"https:\/\/appliedartand.design\/lj\/2025\/04\/27\/a-dash-of-sass\/","title":{"rendered":"A dash of SASS"},"content":{"rendered":"\n<p>Learning the pros and cons of SASS made me want to find out if CSS had similar functions that I could use instead. I did some research on MDN and W3Schools and discovered it did for variables and nesting!<\/p>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/www.w3schools.com\/css\/css3_variables.asp\">CSS Variables &#8211; The var() Function<\/a>&nbsp;<\/h2>\n\n\n\n<p>In the CSS stylesheet, we first declare the variables by using root:. The custom properties are then defined using two dashes, such as &#8211;blue. Please note that custom properties are case-sensitive. &#8211;Blue is not the equivalent of &#8211;blue.<\/p>\n\n\n\n<p>Once the custom properties are defined under :root, we put the variables into rules for the selectors by using var().<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>:root { --blue: #1e90ff; }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>body { background-color: var(--blue); }<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\/CSS_nesting\/Using_CSS_nesting\">Using CSS Nesting<\/a><\/h2>\n\n\n\n<p>Nesting works in CSS similarly to SASS. You put the child selector inside the parent&#8217;s } symbol. Remember to put an &amp; symbol in front of nested compound and pseudo classes, such as :hover.<\/p>\n\n\n\n<p>You can also put the &amp; symbol in front of other nested child elements to ensure ensure backwards compatibility and make them easier to identify.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.parent { color: blue;<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>&amp; #child { font-size: 1em; }<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>}<\/code><\/pre>\n\n\n\n<p>I was disappointed to learn CSS doesn&#8217;t yet have a mixin or extend feature. Fingers crossed they will be added in the future!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learning the pros and cons of SASS made me want to find out if CSS had similar functions that I could use instead. I did some research on MDN and W3Schools and discovered it did for variables and nesting!<\/p>\n","protected":false},"author":94,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[240],"tags":[32,4,3],"class_list":["post-2079","post","type-post","status-publish","format-standard","hentry","category-aad-086-sp25","tag-coding","tag-css","tag-html"],"_links":{"self":[{"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/posts\/2079","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/users\/94"}],"replies":[{"embeddable":true,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/comments?post=2079"}],"version-history":[{"count":1,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/posts\/2079\/revisions"}],"predecessor-version":[{"id":2080,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/posts\/2079\/revisions\/2080"}],"wp:attachment":[{"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/media?parent=2079"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/categories?post=2079"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appliedartand.design\/lj\/wp-json\/wp\/v2\/tags?post=2079"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}