Skip to main content

Command Palette

Search for a command to run...

Simple CSS

Updated
3 min readView as Markdown
Simple CSS
D

Just a confused human trying to find their place in the world. Happy places include, but not limited to: Video games, board games, books, writing, making music, coffee, more coffee, tea, weight lifting, MMA, working with farm animals, tinkering with all the things, hiking.

CSS

It makes things look pretty.

HTML tags simply describe the content of a web page. They let us know what content is meant to be. CSS solves the problem of "How do we make it look pretty?"

There are different ways to define CSS, with <style> tags, in-line style or a separate style sheet. The most common is a separate page for styles, linked to the HTML documents they will edit. Some situations may call for in-line style, but not often. It is important to note that in-line styles will always have the highest priority, meaning they will overwrite styles from the <style> tag or external style sheet.

Syntax and Selectors

Where HTML is written within < > brackets, CSS is written with a couple components:

selector { property: value }

The selector can be:

  • An HTML Element, also called a Grouping Selector (like an h1 tag or nav tag or any other tag you use!)

  • An ID (labeled "id" in the HTML tag)

  • A Class (labeled "class" in the HTML tag)

To name a few options. Let's look at the Codepen below. Take some time to review the comments on each CSS selector and note the syntax as well. Hop between the CSS and HTML files to get a feel for how they are connected. Even better: open up the codepen and play around with it! Try adding the !important flag where it's commented and see how it changes the CSS.

If we look back at our HTML layout for our blog you can start to see where we may pull our selectors from.

The best way to learn how these work, is to experiment! Try them out by forking the codepen and making your own changes to it, or start making some changes to the CSS on our blog-in-progress. As we move along, we'll discuss what changes I am making to the blog, and cover some more in-depth CSS tricks of the trade, as they call them, from grid to flexbox for positioning our content.

Building a Blog/Portfolio

Part 2 of 5

In this series I'll go over the basics of setting up a portfolio/blog. We'll start at the very basic level of structuring our HTML, add in some CSS and build up to eventually convert to Gatsby.JS

Up next

Build a Blog (Pt. 2)

We took a little time to go over basics of CSS, we have our HTML skeleton, now we'll add some styling to the blog based off what we learned, and include a few new things, like media queries. To put it simply, @media rules allow you to use different s...