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 How to Make a Website HTML First Use HTML Elements

Talha Takleh Omar Takleh
Talha Takleh Omar Takleh
3,082 Points

Stuck at Task 4

I don't understand why is it wrong, i thought i only needed to code <meta charset = "utf-8"> inside the <head></head>

Talha Takleh Omar Takleh
Talha Takleh Omar Takleh
3,082 Points

False alarm, i solved it by removing the spaces between charset = "utf-8". I don't know why its like that. Can someone enlighten me, is indentation really important in html?

2 Answers

jag
jag
18,266 Points

When you talk about indentation that means the space from the start of the line.

<div>
    <a>Indentation</a>
</div>

But it's not indentation when you have spaces between an attribute & value, that's called whitespace.

<meta charset="UTF-8">

<meta charset  =  "UTF-8">

You can have whitespace between an attribute & a value but that just adds unnecessary size to your html file. In my opinion it doesn't look professional. As for the validator that checks your work it doesn't want you to have space betwen the attribute & value.

Andy Stoica
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Andy Stoica
Full Stack JavaScript Techdegree Graduate 29,957 Points

Hi Talha,

Speaking strictly of indentation in HTML, it is not a requirement but considered good practice and highly recommended because it makes the structure much clearer and produces more maintainable code. Some text editors offer indentation guides which can be very helpful in debugging situations when, for example, trying to debug a broken layout by searching for closing tags.