Why is there a CSS selector created for an element that doesn't exist?

In the Tribute Page example given for the first project, there’s a CSS selector created for h2.


But I don’t see any h2 elements in the HTML. Is there a reason you’d create a selector for an element you don’t use?

That is probably not meant to be there. However, you’ll notice most frameworks come with pre-styled h1-h6 tags. This is just for ease of use, and if you do want to use a <h2> element in the future, you can do so without having to go back to the code and style it.

For this particular situation, there is no reason for it to be there.

1 Like

That can happen when making changes and not keeping track of both HTML and CSS. Why is there multiple media queries with the same width? Probably the same reason.

1 Like

The h2 selector is my bad, I didn’t notice it when updating the example project. The media queries are intended. I like having them close to the selector they are affecting and not all thrown together in one media query at the bottom.

/start excuses

In my defense, me jumping between the Codepen and the repo, combined with the project test also having to be updated likely made me a bit blind. I was also fixing a few things in the other example projects and I made the new portfolio example project, so I might have had a few too many balls in the air at the time.

It also wasn’t caught in the code review so you know…totally not my fault, lol. :stuck_out_tongue:

/end excuses

I should probably make a PR for it but getting the Codepens updated sometimes take time.

1 Like

No problem, I’m a total beginner so I just didn’t know if it was there for a reason I didn’t understand!

I was just wondering (and couldn’t respond when you first wrote as I was running out of town)- what are you referring to when you wrote “repo” and “PR”?

repo is repository, in this case the freecodecamp repository: https://github.com/freeCodeCamp/freeCodeCamp

pr, pull requests, are the way to propose changes to the codebase (submitting the code)


Yeah sorry, the terminology can get a little inside baseball. But @ieahleen got you covered.

Just FYI the repo is actually this one testable-projects-fcc for the projects and tests.

1 Like