Essential CSS
JavaScript Roadmap
Learn JavaScript
Mastering Web Typography
Practical Astro
Understanding Async JS
Unorthodox Tailwind
API Masterclass
Build and Deploy
The Beginner Freelancer
Real World Node
Profile Billing Logout
Essential CSS
Lesson Plan
  1. Introduction
    1. Welcome to Essential CSS
    2. Getting started with the course
    3. What are file formats?
    4. Web standards
    5. What is HTML?
    6. What is CSS?
    7. Devtools, your indispensable best friend
  2. CSS Key Concepts
    1. Some background about CSS
    2. CSS Syntax and Terminology
    3. Selectors
    4. Cascade and Specificity
    5. Origin and Importance
    6. Inheritance
    7. How browsers handle CSS
  3. Basic Mental Model
    1. Everything on the web is a box
    2. The box model
    3. How big is your box?
    4. The relationship between px and em
    5. The `box-sizing` property
    6. The `display` property
    7. Formatting contexts
    8. Block boxes
    9. Inline boxes
    10. What is inline-block?
  4. Flexbox and Grid
    1. The parent-child relationship
    2. Sizing in Flexbox
    3. Flex directions
    4. Basic grid concepts
    5. Setting up a grid
    6. Placing grid items
    7. Box alignment
  5. Building web layouts
    1. Arranging your boxes on the web
    2. Positioning schemes
    3. Floating boxes
  6. Typography
    1. Making your text look good
    2. What is a font?
    3. Typesetting with CSS

Getting started with the course

3m:29s

If you are already familiar with writing code and code editors in general, feel free to skip this lesson and go straight to the course proper. If not, we’ll help you get set up here.

In theory, all you need as which ever text editing software that comes with your computer. But we suggest you install a code editor because they come with syntax highlighting. This means the code you write will get colour-coded, making it slightly easier to figure out if you typed something wrong, or missed out a closing bracket.

There are many different code editors out there, and if you already have a preferred one, go ahead and use that. If this is your first time writing your own code, we suggest trying out Visual Studio Code (VS Code) because it is cross-platform (meaning it works on Windows, Mac and Linux) and works well out-of-the-box.

You can follow the instructions at https://code.visualstudio.com/docs/setup/setup-overview to install and get it set up, and it should look something similar to this:

Screenshot of the visual studio code interface

We suggest you create a dedicated folder for all the files related to this course to make things easier to keep track of. VS Code has an Explorer interface on the sidebar, and if you drag the folder into VS Code, it will allow you quickly view and access all the files in that folder. For this example, we are naming our new folder Sites.

You can create new files and folders directly from VS Code. Let’s familiarise ourselves by creating a HTML file and a CSS file. If you hover over the first icon next to your folder name, it should say New File. Click on it.

Screenshot where to open a new file in VS code

You will be able to type in the filename of this new file you want to create. Go with index.html and press enter.

Screenshot how to name a file in VS code

If you check the folder now via your computer’s file explorer, you will see your newly created file in the folder.

Copy the contents below into your index.html file. And remember to save the file.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Remember, this shows up on Google</title>
</head>
<body>
<h1>Hello, dinosaur! 🦖</h1>
</body>
</html>

If you open this file with your browser, you should see a page with a heading, and if you look at the tab title, you should see the text within the <title> tag. Feel free to change up the content if you like.

Screenshot of code opened in the browser

Now, let’s also create a new CSS file. Do the same as you did earlier and click on the New File icon. Name the file styles.css this time and press Enter.

Screenshot creating new style.css file in VS code

In the earlier section on Applying CSS to your web page, you learned that connecting an external CSS file to a HTML document is done using the <link> metatag, so let’s add this to your index.html file.

<link rel="stylesheet" href="styles.css" />

So your HTML file should now look like this.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Remember, this shows up on Google</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<h1>Hello, dinosaur! 🦖</h1>
</body>
</html>

Let’s add in a test line of CSS to see if things are working.

body {
background-color: orange;
}

The background of your web page should now be a gaudy orange colour. If not, something might have gone wrong.

Screenshot of code previewed in browser with orange background

Start by checking the spelling of your file names, perhaps you chose to name your CSS file something different from the example. Or it might be you spelled the CSS property incorrectly. These are very common mistakes that even developers who have been doing this for years still run into, so don’t worry about it, it happens to the best of us.