Selector Counting

In a private project of mine I recently had a grid layout (props to Harry Roberts’ csswizardry-grids, which I love). This grid contained links for a user to navigate, but users with few privileges could only see a few of those links, and I didn’t want them to see a three-column grid with only two elements. So I started searching for ways to combine the :nth-child selectors to solve this issue.

Continue reading Selector Counting

Specificity, or Why doesn’t this bloody selector work?

Specificity

When you first start learning specificity, you’re introduced to concepts such as tag selectors, class selectors (dot-prefix) and ID selectors (hash-prefix). You then start writing rules, selecting things left and right — and at some point hit a wall when suddenly a selector doesn’t work.
This is usually due to specificity, the rules that determine which selectors have higher priority.

Continue reading Specificity, or Why doesn’t this bloody selector work?

Where does my CSS come from?

This is the first post in a series on CSS basics. I will be attempting to convey basic concepts that I felt were instrumental in my understanding of CSS, in the hope that it will aid someone learning CSS in their understanding of the syntax and its uses.


Import order

Let’s start at the very beginning, the style imports. This article will cover where the browser loads stylesheets from, which might clear up some confusion when you inspect an element and discover e.g. a margin declaration that you’re sure wasn’t declared anywhere!

Continue reading Where does my CSS come from?

<paragraph type="introduction" obligatory>

Hello World!

This is my brand new blog, where I am intending to have a mix of code-related posts and notes on cooking I did. If you’ve managed to find this blog early in its life, please excuse if it’s a little rough around the edges; I’ll be focusing on content first, then polish 🙂

Relevant XKCD

Relevant XKCD, don’t want to leave you hanging…

</paragraph>