Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Introduction to HTML and CSS (2016) 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!)