How did you learn to understand something that you were really struggling with?

Hi all,

I’m currently studying the Front End Developer career path. I have completed the HTML element and I feel I grasped it pretty well, but to be honest I’m struggling with CSS, more specifically Selectors. It’s the seemingly random syntax that I don’t get - some start with a period, some start with a hashtag. And I can’t get my head around why and when I would need them during a project.

Has anyone else struggled with Selectors? If you were stuck on something else, how did you finally grasp the concept?

Hi, Rick!

When I first started, I also struggled with remembering which selectors to use. Thankfully, I’ve done enough repetition to remember which are which. Right now I’m working on getting as comfortable with combinators. There are a lot of resources online and the MDN Web Docs have a lot of useful information that I use as well! The link I provided will take you to their informational page on CSS selectors. From there, you can choose to read up on the kind of selector that you are having trouble with.

Edit* Also, something you may also want to look at is CSS Specificity!

Happy coding!

1 Like

Hi there. It’s OK that you struggle with CSS after HTML. The more you practice, the more comfortable you will get with it.
Selectors are actually very handy. Class selectors are used to group different elements to apply the same styling to them. Imagine, you have a page where you have an h2 heading, h3 heading and 2 paragraphs, but you want to style h2 and one of the paragraphs in red color, and the rest in green. You would probably use a class selector (the one with a period) to accomplish this task. So, your HTML would look like that:

<h2 class="red">I'm red</h2>
<p class="red">I'm red</p>
<h3 class="green">I'm green</h3>
<p class="green">I'm green</p>

And your CSS like this:

.red {
color: red;
.green {
color: green;

And the id selector (#) is unique within a page. Unlike with classes, you can’t have two elements with the same id on one page. So, if you have four paragraphs, but you want to apply unique styling to each of them, you would probably use id selectors.
When you get to JavaScript, you will also learn how you can use selectors to add javascript to some elements (for example, to make a button do something when you click on it).
Keep practicing and you’ll get it :slight_smile:

Right there with you. I thought that CSS would be a bit of a cakewalk much like HTML and didn’t expect it to get really difficult until I got to JavaScript. The frustrating part is that I feel like I am understanding everything during the lessons, but then I go to apply it to on my own and feel completely lost.

When I get to that point, I’ve found it very important just to keep my head down and keep going. Keep reading posts on here, keep googling, keep reading MDN Web Docs, keep playing with the problem until it finally clicks.
It can be frustrating especially when you spend a whole day trying to really understand something that you thought would take only an hour, but I am finding out that really is what it takes.

I think its a bit like unravelling a bad knot. It sucks until you find that one little piece that gives, then you find another piece and then another and it starts to feel like its all clicking the further along you get.

1 Like