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 Treehouse Club: CSS My First Web Page Introduction to My First Web Page

Ian Johnson
Ian Johnson
1,517 Points

Does the method for including comments differ between .HTML and .CSS formatting?

I'm sure Joy stated comments are written as <!-- blah blah blah --> in a previous vid [I wrote this in my notes], but they look to be written as /****** blah blah blah ******/ in CSS sheets?

Are comments set up differently between the two formats?

3 Answers

Yes, the comments are formatted differently.

<!-- This is a comment in html. -->
/* This is not a comment in html and will be treated as text. */
/* This is a comment in css. */
<!-- This is not a comment in css and no css past this point will be interpreted. -->
Ian Johnson
Ian Johnson
1,517 Points

Oh, that's interesting - you don't have to define text with any tags to include it in the document... and it can go anywhere in the document (i.e. before/after <html>/<body>/etc. tags)?

Further daft question; am I right in thinking the '< >' bits that define sections of the html document are referred to as 'tags', but once filled out with some form of definition/content (e.g. <head>/<body>/etc.) it becomes an element? Further to that, attributes (e.g. <lang>/<meta>/etc.) define additional characteristics or properties of the element - similar to how an adjective would describe/modify a noun?

I'm struggling to wrap my head around some of the nomenclature, aha.

Thanks again for the assistance.

HTML is very forgiving and tries to make sense of your input even if it isn't in the correct format. You can output text without tags in most places of the document. One exception is when you place your text between < and > of a tag, where it is interpreted as attributes. However, it is not recommended to output the text without using tags.

<head>, <body>, <p> and </p> would be tags. <p>This entire code block is an element.</p> is an element, including its tags and the content between them.

Your ideas about what attributes do is correct. lang is an attribute, and is placed within a tag such as <html lang="en">, but isn't used as a tag by itself. <meta> is a tag rather than an attribute, and attributes such as charset are added in its tag: <meta charset="utf-8">.

Ian Johnson
Ian Johnson
1,517 Points

Thank you very much, @jb30.