Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS How to Make a Website CSS: Cascading Style Sheets Use ID Selectors

Badrul Lasker
Badrul Lasker
909 Points

Close curl bracket "}" not required?

I see that the instructor used right and left curl bracket in his main.css file, but when I tried removing the right curl bracket it worked too. So is it that the right curl bracket here is of no use?

Christopher Loyd
Christopher Loyd
Courses Plus Student 5,806 Points

To add to what other users have said in their answers, there are many things in both HTML and CSS that the browser is lenient on when it comes to understanding your code. However, even though it MAY work in the browser, because the browser has protected users from their own mistake, this still puts more work on the browser as it has to guess what you're trying to tell it rather than explicitly telling it how you're wanting your code to run. Therefore, having many instances of these issues in the same code may slow down your website when it loads.

3 Answers

It might work if it's the last line in your CSS file, but if it isn't then more than likely it will create an error and cause styles that are below the error to not work properly. It's best to close it to avoid any possible errors. It won't actually say ERROR, but it will ignore styles silently.

Badrul Lasker
Badrul Lasker
909 Points

Oh! that makes sense. Thank you.

You need to use curly brackets to avoid confusion in coding and possible CSS errors as anything inside the bracket is the property of the class or the id defines in the stylesheet