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.

HTML Introduction to HTML and CSS Adding a New Web Page Write the CSS

Indentions

Is there a method when determining the level of indention used? For example, when writing CSS for body and .main-image, Treasure seems to indent each line. Once I hit enter to write on a new line, can I simply begin writing or is it best practice to always indent so many characters?

1 Answer

Podrig Leoghain
Podrig Leoghain
5,094 Points

In HTML and CSS indentation is for readability. So yes you could just type away and nothing bad would happen when you use it (if the code is correct, of course). However, it might not be as easy to read after writing e.g. 50 lines of CSS.

I believe JavaScript uses the same indentation so don't worry about getting it wrong.

Awesome, so essentially it is personal preference if I choose to indent each block once or twice with HTML or CSS. Appreciate the clarification!

Podrig Leoghain
Podrig Leoghain
5,094 Points

No problems, happy to answer your question.

Podrig Leoghain
Podrig Leoghain
5,094 Points

(Feel free to mark the best answer!)