<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paulina M</title>
    <description>The latest articles on DEV Community by Paulina M (@crypto3p).</description>
    <link>https://dev.to/crypto3p</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F816586%2F3ad38502-af97-43d0-8778-11eb8bddf35b.PNG</url>
      <title>DEV Community: Paulina M</title>
      <link>https://dev.to/crypto3p</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/crypto3p"/>
    <language>en</language>
    <item>
      <title>JavaScript Explained - Introduction</title>
      <dc:creator>Paulina M</dc:creator>
      <pubDate>Fri, 25 Feb 2022 12:00:02 +0000</pubDate>
      <link>https://dev.to/crypto3p/javascript-explained-introduction-2i5i</link>
      <guid>https://dev.to/crypto3p/javascript-explained-introduction-2i5i</guid>
      <description>&lt;p&gt;Quite often beginners are struggling to grasp the concepts and methods not just with JavaScript but starting programming in general. While it is possible to learn the language and use it just by learning the syntax, watching tutorials etc., understanding and simplifying how it all works behind the scenes is what makes the beginners and even more experienced programmers have confidence in their skills and the ability to progress further. &lt;/p&gt;

&lt;p&gt;Learning a programming language can be challenging and seem scary at first. This post is meant to serve absolute beginners in understanding the core principles of JavaScript and making it less daunting to jump right in and really understand the code they're writing.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;We'll be looking at the JavaScript from the client side perspective (front end) but JS can be front and back end.&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Focus on building real stuff, and taking it to the next level as we go through it. Thinking of it as LEGO blocks - collect them, take it apart, play with it. Personalise it, leave your anxiety at the door and build something cool.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;IDs and Classes&lt;/strong&gt;&lt;br&gt;
Being already familiar with HTML and CSS, you've come across IDs and classes. Instead of only using them to style certain elements and components, JavaScript allows us to target those IDs or classes and add interactivity and control their behaviour, listening for clicks, putting stuff in, taking stuff out... pretty much anything you could think of, we can do with JavaScript.&lt;/p&gt;
&lt;h2&gt;
  
  
  Syntax
&lt;/h2&gt;

&lt;p&gt;Now, every programming language has it's specific "spelling and grammar" rules which we call syntax. Though seeing it for the first time makes people have a panic attack, close it and never come back. It looks too complicated and for some, it can be overwhelming.&lt;br&gt;
The thing is, it's not supposed to make sense just yet. Especially if you haven't got much/any previous programming experience. &lt;strong&gt;What you have to do is type it out, play with it, break it, delete it and do it all over again.&lt;/strong&gt; That's how you start to notice patterns and that's all programming is early on - &lt;strong&gt;pattern recognition&lt;/strong&gt;. Overtime, you'll start to recognise more of those patterns, find new "building blocks" and you will start building more complicated things. What you want to stay away from early on is obsessing over what things are called, trying to memorise everything you see.. terminology doesn't matter right now. &lt;strong&gt;You are better off building stuff than scrolling through MDN for three hours.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That being said, let's see some JavaScript.&lt;/p&gt;
&lt;h2&gt;
  
  
  Variables
&lt;/h2&gt;

&lt;p&gt;We can tell our program to remember values for us to use later on, and we can do that by using variables.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age = 20
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;let age&lt;/code&gt;- declaration&lt;br&gt;
&lt;code&gt;age = 20&lt;/code&gt; - assignment&lt;/p&gt;

&lt;p&gt;Think of it as &lt;strong&gt;information buckets&lt;/strong&gt;. We create a bucket and give it a name (declaration) and we put stuff into that bucket (assignment).&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;That's all variables do. Create buckets of data and in some future point we can go back and use it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code&gt;let&lt;/code&gt; is one of the special (reserve) words JavaScript looks for and understands. When it sees &lt;code&gt;let&lt;/code&gt;, alarm bells go off in JS saying that someone is trying to create a bucket of data. When it sees the word &lt;code&gt;let&lt;/code&gt;, it creates a space in memory and we have essentially created a new space in memory called &lt;code&gt;age&lt;/code&gt; and stored the value of &lt;code&gt;20&lt;/code&gt; in that space.&lt;/p&gt;

&lt;p&gt;Now let's say we want to store a location - create a bucket for it.&lt;br&gt;
In that case, a declaration step would be &lt;code&gt;let location&lt;/code&gt; (creating a new space in memory called location&lt;br&gt;
An assignment step would be &lt;code&gt;location = "London"&lt;/code&gt; and we can also write it together as &lt;code&gt;let location = "London"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we can actually start to use these things we stored in memory. I can say &lt;em&gt;"Dave is &lt;code&gt;age&lt;/code&gt;, Dave is in &lt;code&gt;location&lt;/code&gt;".&lt;/em&gt; We're trying to use these variables and it will say &lt;em&gt;"Dave is 25, Dave is in London"&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;As we go on - as Dave gets older and moves around, we can change these values, without having to change the actual use. We can use these variables at any point in our program, change them, subtract or add to them and pretty much anything you want to do with them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Variables and Data Types
&lt;/h2&gt;

&lt;p&gt;So far we've seen two types of data:&lt;br&gt;
Numbers - 20 &lt;br&gt;
String (just a fancy way of saying text) - London&lt;br&gt;
A string is always surrounded by quotes - single or double - or ticks (`), but we'll focus on quotes for now.&lt;/p&gt;

&lt;p&gt;Whatever quotes you use on the outside, you can't use on the inside (without doing some tricks).&lt;br&gt;
For example, trying to use double quotes on the outside and inside of the string, we'll run into some issues. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ea81nhron9aaccbiv48.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0ea81nhron9aaccbiv48.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We get two separate strings. What JavaScript will try to do is look for a variable called "moved" and we'll get an error because there is nothing in memory called "moved" - we haven't declared it.&lt;/p&gt;

&lt;p&gt;Now we can tell JS to ignore these quotes by using a backslash before each of them and we can do the same with single quotes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyysl63tgq0ceec4papen.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyysl63tgq0ceec4papen.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Numbers and Arithmetic
&lt;/h2&gt;

&lt;p&gt;Numbers represent numerical data, they can be integers and floats, positive or negative in value.&lt;br&gt;
int : +6&lt;br&gt;
float : -5.12385&lt;/p&gt;

&lt;p&gt;Arithmetic operators are the ones that handle our math. You don't really need math to be a full stack developer, but we do need basic arithmetic. &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operator&lt;/th&gt;
&lt;th&gt;Meaning&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;Addition&lt;/td&gt;
&lt;td&gt;8 + 10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;Subtraction&lt;/td&gt;
&lt;td&gt;10 - 8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;*&lt;/td&gt;
&lt;td&gt;Multiplication&lt;/td&gt;
&lt;td&gt;12 * 2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;/&lt;/td&gt;
&lt;td&gt;Division&lt;/td&gt;
&lt;td&gt;10 / 5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&amp;amp;&lt;/td&gt;
&lt;td&gt;Modulus&lt;/td&gt;
&lt;td&gt;10 % 6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Conditionals
&lt;/h2&gt;

&lt;p&gt;Logical operators used for making decisions and comparisons&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagrqoh93g8z57wjsdw2r.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagrqoh93g8z57wjsdw2r.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Keeping in mind that one equal sign is only for assignment, while two or more are used when comparing values and types.&lt;/p&gt;

&lt;p&gt;** Conditional Syntax **&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
if (condition is true) {&lt;br&gt;
    // do this thing&lt;br&gt;
} else if (condition is true) {&lt;br&gt;
    // do this other thing &lt;br&gt;
} else {&lt;br&gt;
    // default thing&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;You can have as many &lt;code&gt;else if&lt;/code&gt;s as you want, and as soon as you hit something that is true, it runs and stops. It doesn't check it any further. &lt;br&gt;
Else statement is the "default", a fallback if none of the conditions were true.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
const food = "pizza"&lt;br&gt;
if (food === "cheeseburger") {&lt;br&gt;
    console.log("Not bad") &lt;br&gt;
} else if (food === "pizza") {&lt;br&gt;
    console.log("Dominos!")&lt;br&gt;
} else {&lt;br&gt;
    console.log("Are you even trying?")&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In this case, we used &lt;code&gt;const&lt;/code&gt; instead of &lt;code&gt;let&lt;/code&gt;. Using &lt;code&gt;const&lt;/code&gt; means that we won't be able to reassign it. Meaning, in this case, food will always be pizza and nothing else. &lt;/p&gt;

&lt;h2&gt;
  
  
  Multiple Conditions
&lt;/h2&gt;

&lt;p&gt;We can also use a similar syntax to check multiple conditions at the same time.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
if (name === "Tony" &amp;amp;&amp;amp; state === "captured") {&lt;br&gt;
    //Build a mechanised suit of armour&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if his name is Tony AND he is captured to build a weapon of mass destruction, he builds an armoured suit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;&lt;br&gt;
if (day === "Saturday" || day === "Sunday") {&lt;br&gt;
    //It is the weekend&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;if it's Saturday OR Sunday, it means it's the weekend&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next time we'll go through some actual programs and seeing it in action but you can see some examples on my &lt;a href="https://github.com/crypto3p/100Devs" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; if you want to play with it! &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Creating a CSS Design System</title>
      <dc:creator>Paulina M</dc:creator>
      <pubDate>Wed, 16 Feb 2022 17:39:42 +0000</pubDate>
      <link>https://dev.to/crypto3p/creating-a-css-design-system-1dha</link>
      <guid>https://dev.to/crypto3p/creating-a-css-design-system-1dha</guid>
      <description>&lt;p&gt;When creating a multi-page website, it’s good to have a design system in place that ties everything together. &lt;br&gt;
Having taken a course by the CSS guru Kevin Powell, I thought it would be great if there was a way to reference it as needed and go back to certain areas afterwards. That’s exactly what this post is about. &lt;br&gt;
The course is 7 hours long and he goes into great detail about the creation of the design system, the whole website itself, and how everything works together. It’s a great resource, even for beginners with basic HTML and CSS knowledge as he does a great job explaining everything.&lt;br&gt;
That being said, I would definitely recommend taking the course. It’s free, you can find it on YouTube or freecodecamp.org. &lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;Figma files referenced are available on frontendmentor.io &lt;/li&gt;
&lt;li&gt;You can visit my finished product at &lt;a href="https://designsystemcss.netlify.app" rel="noopener noreferrer"&gt;https://designsystemcss.netlify.app&lt;/a&gt;
See the complete source code &lt;a href="https://github.com/crypto3p/Design-System" rel="noopener noreferrer"&gt;https://github.com/crypto3p/Design-System&lt;/a&gt;
---
We’re going to be recreating this design system for a space travel website.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting up
&lt;/h2&gt;

&lt;p&gt;Custom properties for colours, fonts and font sizes&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

:root {
    --clr-dark: 230 35% 7%;
    --clr-light: 231 77% 90%;
    --clr-white: 0 0% 100%;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

/* font sizes */
    --fs-900: 9.375rem;
    --fs-800: 6.25rem;
    --fs-700: 3.5rem;
    --fs-600: 2rem;
    --fs-500: 1.75rem;
    --fs-400: 1.125rem;
    --fs-300: 1rem;
    --fs-200: 0.875rem;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

/* font families */
    --ff-serif: "Bellefair", serif;
    --ff-sans-cond: "Barlow Condensed", sans-serif;
    --ff-sans-normal: "Barlow", sans-serif;
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Using rems instead of pixels&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;using pixels may overwrite settings that the user has put in place to give them bigger/smaller default font size&lt;/li&gt;
&lt;li&gt;easy to convert to rems = divide any value in px by 16&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Using RGB and HSL values&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Makes it easy to tweak the alpha value (opacity) when needed by adding &lt;code&gt;/ &amp;lt;value&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;HSL being a new syntax, no commas needed, supported in all modern browsers
Though storing it like this:
```
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;hsl(230 35% 7%)&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;would make it difficult to modify the alpha value later on, so we will be storing it like this:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;--clr-dark: 230 35% 7%;&lt;br&gt;
--clr-light: 231 77% 90%;&lt;br&gt;
--clr-white: 0 0% 100%;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;For example, we create a new class `.example` and if we wanted to give it a light background at 20% opacity:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;background-color: hsl( var( — clr-light) / .2 );&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;which gives exactly the same output as writing it without a custom variable:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;background-color: hsl(231 77% 90% / .2);&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt; Resetting body margins, box sizing, setting up the body, form elements and images can be seen in the source code with comments explaining everything more in depth if needed

##Accessibility


**Creating a screen-reader-only class:**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.sr-only {&lt;br&gt;
    position: absolute;&lt;br&gt;
    width: 1px;&lt;br&gt;
    height: 1px;&lt;br&gt;
    padding: 0;&lt;br&gt;
    margin: -1px;&lt;br&gt;
    overflow: hidden;&lt;br&gt;
    clip: rect(0, 0, 0, 0);&lt;br&gt;
    white-space: nowrap; /* added line */&lt;br&gt;
    border: 0;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**sr-only vs display:none**
- sr-only keeps it in the DOM, it just fully visually hides it, while `display:none` removes it and it is no longer on the page

**Remove animations for people who have turned them off**
- `prefers-reduced-motion` media query — meaning people took the time to turn off animations, either in browser settings or OS level
- for people who motion causes problems i.e. parallax scrolling, scroll linked animations etc.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a class="mentioned-user" href="https://dev.to/media"&gt;@media&lt;/a&gt; (prefers-reduced-motion: reduce) {&lt;br&gt;
    *,&lt;br&gt;
    *::before,&lt;br&gt;
    *::after {&lt;br&gt;
        animation-duration: 0.01ms !important;&lt;br&gt;
        animation-iteration-count: 1 !important;&lt;br&gt;
        transition-duration: 0.01ms !important;&lt;br&gt;
        scroll-behavior: auto !important;&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
##Colour utility classes

Going on to recreate the following part of the design system:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/293uhyi4tztg9gedekcw.png)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.flex {&lt;br&gt;
    display: flex;&lt;br&gt;
    gap: var(--gap, 1rem);&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.grid {&lt;br&gt;
    display: grid;&lt;br&gt;
    gap: var(--gap, 1rem);&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- You may noticed that we haven’t previously defined the `--gap` property, so 1rem becomes the default. Now we can redefine this custom property, either inline in HTML or with a custom class by adding `--gap: 2rem;`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.bg-dark {&lt;br&gt;
    background-color: hsl( var(--clr-dark) );&lt;br&gt;
}&lt;br&gt;
.bg-accent {&lt;br&gt;
    background-color: hsl( var(--clr-light) );&lt;br&gt;
}&lt;br&gt;
.bg-white {&lt;br&gt;
    background-color: hsl( var(--clr-white) );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.text-dark {&lt;br&gt;
    color: hsl( var(--clr-dark) );&lt;br&gt;
}&lt;br&gt;
.text-accent {&lt;br&gt;
    color: hsl( var(--clr-light) );&lt;br&gt;
}&lt;br&gt;
.text-white {&lt;br&gt;
    color: hsl( var(--clr-white) );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
##Typography 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0ugm27xg68omw6kmkt18.png)

Creating utility classes = breaking things up
- we want to keep things doing one job
- everything becomes more plug and play
- creating classes also enables us to write more semantic HTML — meaning an element is doing exactly what it should (an h2 element being a headline rather than the heading styling something ) and adding to accessibility



&amp;gt; I didn’t turn letter spacing into custom properties as I don’t see them changing very often, though if you prefer to set them as a custom property that would be completely fine
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.ff-serif { font-family: var(--ff-serif);}&lt;br&gt;
.ff-sans-cond { font-family: var(--ff-sans-cond);}&lt;br&gt;
.ff-sans-normal { font-family: var(--ff-sans-normal);}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.letter-spacing-1 { letter-spacing: 4.75px; }&lt;br&gt;
.letter-spacing-2 { letter-spacing: 2.7px; }&lt;br&gt;
.letter-spacing-3 { letter-spacing: 2.35px; }&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.uppercase { text-transform: uppercase;}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.fs-900 {font-size: var(--fs-900);}&lt;br&gt;
.fs-800 {font-size: var(--fs-800);}&lt;br&gt;
.fs-700 {font-size: var(--fs-700);}&lt;br&gt;
.fs-600 {font-size: var(--fs-600);}&lt;br&gt;
.fs-500 {font-size: var(--fs-500);}&lt;br&gt;
.fs-400 {font-size: var(--fs-400);}&lt;br&gt;
.fs-300 {font-size: var(--fs-300);}&lt;br&gt;
.fs-200 {font-size: var(--fs-200);}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.fs-900,&lt;br&gt;
.fs-800,&lt;br&gt;
.fs-700,&lt;br&gt;
.fs-600 {&lt;br&gt;
    line-height: 1.1;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
Adding the font class to h elements might render a bit funny, since the h elements are bold by default and we didn’t include the bold in google fonts. So what we want to do is specify the font weight of those elements to be 400 since we are not going to see a lot of bold in this project.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eo8kn1k5ebdxmb51p98k.png)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;h1,&lt;br&gt;
h2,&lt;br&gt;
h3,&lt;br&gt;
h4,&lt;br&gt;
h5,&lt;br&gt;
h6 {&lt;br&gt;
    font-weight: 400;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sygbbwwv917x6scg9ut1.png)

##Numbered Titles

Utility classes allow us to work quickly ,but when we have something like numbered titles here, that is always the same, it’s good to find a balance — making a utility class2.0 let’s say, just for those numbered titles


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ov5140emljp84b0lz6hq.png)

&amp;gt; Ems and rems for most when it comes to sizing things, but we’re leaving letter spacing as pixels since it’s quite a small value. There is nothing wrong with using pixels for very small and specific things every now and then
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.numbered-title {&lt;br&gt;
    font-family: var(--ff-sans-cond);&lt;br&gt;
    font-size: var(--fs-500);&lt;br&gt;
    text-transform: uppercase;&lt;br&gt;
    letter-spacing: 4.72px;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.numbered-title span {&lt;br&gt;
    margin-right: .5em;&lt;br&gt;
    font-weight: 700;&lt;br&gt;
    color: hsl( var(--clr-white) /.25 );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;gt; We’re setting letter spacing (margin) for span in ems so it’s relative to font size. If the font would be something different, margin would adapt with it.
##Spacing

Utilities for spacings are very common, but don’t think we need it for this design. We’ll use a modern solution, with one utility class and just one modern pseudo class that’s recently been added to CSS, supported by most modern browsers.
Going to general utility classes in our CSS file, we’ll add the following code:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.flow &amp;gt; * + * {&lt;br&gt;
    margin-top: 1rem;&lt;br&gt;
    outline: 1px solid red;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;gt; idea by Andy Bell, lobotomised owl (termed by Hayden Pickering)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xt650x3299w87mmgjlsz.png)

**How it works:**
- the + sign here is an adjacent sibling combinator. It is looking for elements that have adjacent siblings that come before it i.e. selects everything that has an adjacent sibling directly before it hence why it wasn’t applied to the first element in our div.
**Another way to write it:**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.flow &amp;gt; *:not(:first-child) {&lt;br&gt;
    margin-top: 1rem;&lt;br&gt;
    outline: 1px solid red;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- selecting anything (*) that is not the first child

_Why we would use the * + * (lobotomised owl) method :_
- * +* has no extra specificity to it.
- the `.flow` has specificity, which is important because on our paragraphs and headings we set a margin of 0. So we need the specificity to overwrite that to add a margin-top on them.

_Using *:not(:first-child)_
- this is a pseudo class, which has the same specificity as a class selector
- can lead to potential problems where you can’t overwrite something, needing an !important somewhere

A way to overcome that is with a very modern piece of CSS, adding `:where`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.flow &amp;gt; *:where:not(:first-child) {&lt;br&gt;
    margin-top: 1rem;&lt;br&gt;
    outline: 1px solid red;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:where and :is being new selectors
- using :is wouldn’t help, it would be the exact same situation
- generally used as different way to group things

For example: instead of writing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.card h1,&lt;br&gt;
.card h2,&lt;br&gt;
.card h3 {&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;what we can do is
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;card :where(h1, h2, h3) {&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;or
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;card :is(h1, h2, h3) {&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;The difference between :is and :where
- :is will take the highest specificity selector and apply it to the entire rule
- :where doesn’t add any specificity


## Interactive Elements


**The Explore Button**
We’ll be adding all the existing utility classes first instead of creating another one like we did with numbered titles:
- Maybe in the future it gets updates, maybe we need a second button with slight modifications. So we don’t need to create a new class to be able to accommodate it.

So setting things up with our utility classes, finishing up with the large-button class for final touches is one approach you can take.


&amp;gt; We could’ve also taken the same approach on numbered titles, but for the purpose of showing different approaches and how or when they might be used we are going to switch it up

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.large-button {&lt;br&gt;
    position: relative;&lt;br&gt;
    z-index: 1;&lt;br&gt;
    display: grid;&lt;br&gt;
    border-radius: 50%;&lt;br&gt;
    place-items: center; &lt;br&gt;
    padding: 0 2em;&lt;br&gt;
    aspect-ratio: 1;&lt;br&gt;
    text-decoration: none;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;gt; because `&amp;lt;a&amp;gt;` is an inline element, we can’t really give it padding on top and bottom. We can, but it would overlap with the elements above or below it

Instead of using width and height of 100px, we’ll be using a modern solution `aspect-ratio` which will turn it into a perfect square when setting the value of 1 (same as 1 / 1)
- 2 / 1 would make it twice as wide as it is high
- 2 / 1 twice as tall as it is wide


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fmwxyh915np4v5nsdpil.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/npfq57n62yp7x67z0wrp.png)

`display:grid` instead of inline block so we can easily place the text in the middle of the block with `place-items:center` (shorthand for align-items and justify-items)
- can do it with flex, but we’re keeping it shorter, just in one line we got it right in the middle



**Creating the hover effect:**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.large-button::after {&lt;br&gt;
    content: '';&lt;br&gt;
    position: absolute;&lt;br&gt;
    background: hsl( var(--clr-white) / .15 );&lt;br&gt;
    width: 100%;&lt;br&gt;
    height: 100%;&lt;br&gt;
    z-index: -1;&lt;br&gt;
    border-radius: 50%;&lt;br&gt;
    opacity: 0;&lt;br&gt;
    transition: opacity 500ms linear, transform 750ms ease-in-out;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Using the pseudo class, we need `content:’’` for it to work
- .large-button z-index of 1
- .large-button::atfter z-index of -1


&amp;gt; you can leave out the z-index on large-button and in this situation it wouldn’t make a difference but it’s a good practice to force the stacking context by adding a z-index of 1 when we have a absolutely positioned element inside (in this case to .large-button) to prevent any issues down the line

**Adding the animation:**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.large-button:hover::after,&lt;br&gt;
.large-button:focus::after {&lt;br&gt;
    transform: scale(1.5);&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
## Underline Indicators


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l82s8iejvsn0maow66zc.png)

Since we have the same underline effect in two places in this case, we don’t want to be repeating the same thing for both, so we’ll be creating a new class of `underline-indicators` alongside `primary-navigation`.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.primary-navigation {&lt;br&gt;
    --underline-gap: 3rem;&lt;br&gt;
    --gap: 4rem;&lt;br&gt;
    list-style: none;&lt;br&gt;
    padding: 0;&lt;br&gt;
    margin: 0;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.primary-navigation a {&lt;br&gt;
    text-decoration: none;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.primary-navigation a &amp;gt; span {&lt;br&gt;
    font-weight: 700;&lt;br&gt;
    margin-right: .5em;&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.underline-indicators &amp;gt; * {&lt;br&gt;
    padding: var(--underline-gap, 1rem) 0;&lt;br&gt;
    border: 0;&lt;br&gt;
    cursor: pointer;&lt;br&gt;
    border-bottom: .2rem solid hsl( var(--clr-white) / 0 );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You can also make it as a utility class and place it for each one of the links, Though this way, you will put the class in only one place instead of multiple, allowing for grouping and just a little bit less work.

Setting the padding on the border (our underline), might work in this situation, but we want to reuse it on another element that needs underlining and that one looks like it would need less of a padding.

To accommodate this, we are going to use a custom property — `underline-gap` and set the default to 1rem

**Hover, focus and active effects**

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.underline-indicators &amp;gt; *:hover,&lt;br&gt;
.underline-indicators &amp;gt; *:focus {&lt;br&gt;
    border-color: hsl( var( - clr-white) / .25);&lt;br&gt;
}&lt;br&gt;
.underline-indicators &amp;gt; .active {&lt;br&gt;
    border-color: hsl( var( - clr-white) / 1);&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**Underline indicators — tabs**
While we’ve already done most of the heavy lifting with underline indicators above, there are a few things that would need tweaking. After adding the utility classes to button elements to style the text, adding the `underline-indicators` class to the div element gives this outcome.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m25g7f18kulo9i28kjet.png)

First, we see that we need more space between them, and we can easily fix that by adding the `flex` class.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ss50xegz7925e4jjufrl.png)

Now to tweak things further, we are going to add a custom class `tab-list`, just like we did previously with `primary-navigation` class.

What we can do now is go back to this section:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.underline-indicators &amp;gt; * {&lt;br&gt;
    padding: var( - underline-gap, 1rem) 0;&lt;br&gt;
    border-bottom: .2rem solid hsl( var( - clr-white) / 0 );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;and add a cursor and a border of 0 before `border-bottom`. This will remove any borders that might be there by default — like the button borders above.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.underline-indicators &amp;gt; * {&lt;br&gt;
    padding: var( - underline-gap, 1rem) 0;&lt;br&gt;
    border: 0;&lt;br&gt;
    cursor: pointer;&lt;br&gt;
    border-bottom: .2rem solid hsl( var( - clr-white) / 0 );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9j6w9azucynyjlw0ec0j.png)

Lastly, we can change the gap with the `tab-list` class we created earlier (or you can change it inline).

**Adding the active state**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Moon
Mars
Europa
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

-  aria-selected = accessible rich internet applications
 - Something we can use to give extra context to assistive technologies. And since we’re going to be turning this area into a tabs system, it’s a way to let them know that this is a selected tab
- It’s different than links, since with links we are going to a different html page and with tabs, we are staying on the same page but essentially moving the content around

Now we can add this attribute to the CSS
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.underline-indicators &amp;gt; .active,&lt;br&gt;
.underline-indicators &amp;gt; [aria-selected="true"] {&lt;br&gt;
    border-color: hsl( var( - clr-white) / 1);&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**Dot indicators**
Very similar to tab indicators.
Now we will use the `sr-only` class created at the beginning by wrapping the title in a span and adding the `sr-only` class to it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;span&amp;gt;slide title&amp;lt;/span&amp;gt;
&amp;lt;span&amp;gt;slide title&amp;lt;/span&amp;gt;
&amp;lt;span&amp;gt;slide title&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**Number indicators**
Following the example of previous indicators, finish up the design system with number indicators.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1
2
3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;.number-indicators &amp;gt; *{&lt;br&gt;
    margin: 1.7rem;&lt;br&gt;
    padding: 0;&lt;br&gt;
    cursor: pointer;&lt;br&gt;
    color: hsl( var( - clr-white) );&lt;br&gt;
    border: 3px solid hsl( var( - clr-white) /.5 );&lt;br&gt;
    border-radius: 50%;&lt;br&gt;
    aspect-ratio: 1;&lt;br&gt;
    border-color: hsl( var( - clr-white) /.25 );&lt;br&gt;
}&lt;br&gt;
.number-indicators &amp;gt; *:hover,&lt;br&gt;
.number-indicators &amp;gt; *:focus {&lt;br&gt;
    border-color: hsl( var( - clr-white) / 1 );&lt;br&gt;
}&lt;br&gt;
.number-indicators &amp;gt; [aria-selected="true"] {&lt;br&gt;
    background-color: hsl( var( - clr-white) / 1);&lt;br&gt;
    color: hsl( var( - clr-dark) );&lt;br&gt;
}&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;See the finished design at https://designsystemcss.netlify.app
See complete source code at https://github.com/crypto3p/Design-System
I’m happy to receive any questions or comments here or you can contact me at info@pmweb.uk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>css</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
