FAQ: Learn CSS Selectors Visual Rules - CSS Setup Selectors - The CSS File

Community%20FAQs%20on%20Codecademy%20CSS%20Exercises

This community-built FAQ covers the “The .css file” exercise in Codecademy’s CSS lessons.

FAQs on the CSS exercise the .css file

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about CSS in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

quick question : instead of using h4 on the more destinations sections , is it possible to also use em or b to get the bolder text with the same outcome?

Thanks,
Taj

Why we need to use “p” instead of “title” in the .css document? As the exercise oriented, I copied and pasted the lines between ; the it only ran when I changed “title” by “p”".
Thanks"

Using <p> will allow every paragraph tag in the html doc to be affected. I’m not sure if <title> is something that would go in css, as far as I’ve learned, the <title> element is just for naming the tab of the web page at the top of the browser.

Since no one answered, I’ll through in my 2 cents. I can tell you it’s definitely POSSIBLE, since I just did it after reading your post. I wasn’t aware that the <b> and <strong> tags were the same size text as the <h4> tag. (I’m guessing you meant the <strong> tag in your post and not <em> which puts it in italics.)

With that said, is it practical or semantically correct to do so? I not sure, but I’d guess probably not. Seems like a doc filled with other header tags, should also use the <h4> instead of swapping it for the other ones. Someone smarter than me can explain better.

Strange, the exercise asked me to cut and past the CSS element from the HTML into the CSS sheet but it was already there…

2 Likes

Where the p came from in style.css file. That is not mentioned anywhere in ‘Learn’ section.

The p refers to the paragraph element in the HTML.

Putting p in the CSS file means that whatever code you put within the curly braces (font-size, color, etc) will only affect the p paragraph elements in the HTML

I did the exercise instructions but the paragraph didn’t change to Arial when I ran it. Even though the box got checked and next lit up like I did it correctly.

quick question:
Learn CSS: Selector and Visual-Step 4 asks to do the following.
Cut the CSS code in between the opening and closing <style> tags and paste it directly in the new file called style.css .

I did what was asked and I’m getting an error asking “Did I remove the paragraph style from index.html and put it in the style.css?” Yes I did and this is what I cut and pasted

4 Likes

That’s because you haven’t linked the style.css file in the of your HTML file yet. It’ll be covered in the following lesson.

I had the same experience. The only thing I saw different from what was shown in the solution was that my line of css did not have a semi-colon at the end, which should not be required. There was also no indication of what was wrong. I tried both deleting the style tags and leaving them empty with the correct property defined for the p selector and I got this error as well.

hi, i encountered the same error, please where you able yo solve it? if yes please share with me the code because i am stocked here.

Both the strong and em tags deliver a degree of importance to the text that CSS or b don’t deliver. Semantically it’s not correct to replace a h4 tag for b or strong tag

1 Like

The way this is described is confusing for beginners. The wording used in “4. The .css file” makes it seem like you should place the inline “p style=“font-family: Arial;”” into the .css document, when in reality you need to place the actual .css formatting into the document for it to work.

Ex: p {
font family: Arial;
}

An edit to clarify would be helpful.

I’ve tried this but can’t move to the next step. What am i doing wrong?

I ended up viewing the solution which was exactly what I’ve typed. What gives?

I had the same problem and realized (at least in my case!) that it was being very picky about the formatting/indentation of the code. I had to remove all indentation from the CSS code and have it flat, like this:

p {
font-family: Arial;
}

for it to register. Also don’t forget the hyphen (-) in “font-family”!

I also got the same problem. But the solution is…
In HTML, the head section should have remain empty style tag. And CSS file as like as instruction.

1 Like

I also got the same problem. But the solution is…
In HTML, the head section should have remain empty style tag. And CSS file as like as instruction.

1 Like