Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit f2703a4

Browse files
committed
Add section in the first chapter about HTML comments (addresses Issue #14)
1 parent b288d2c commit f2703a4

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

core/structure.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,36 @@ in order to have a more clear document and still be able to work with it
170170
even after a long time or when there is a lot of lines of code. It also shows
171171
the heircharcical nature of HTML pretty well.
172172

173-
******
173+
## Comments
174+
175+
It is also possible to put "comments" in your HTML. Comments in HTML are there
176+
to remind you (or other people editing the HTML file) without changing the way
177+
the page displays in a browser.
178+
179+
Like other HTML elements, comments are written by using a tag. Although comment
180+
tags look a little different:
181+
182+
<!-- I am a comment -->
183+
184+
The "start comment" tag is `<!--` and the "end comment" tag is `-->`.
185+
186+
Comments can also enclose other HTML elements, to "comment them out". This is a
187+
useful technique when you're experimenting with a page to see how it looks when
188+
you change things around.
189+
190+
For example, try commenting out the `h1` heading in your current page:
191+
192+
<body>
193+
<!-- <h1>I'm the title.</h1> -->
194+
<p>And I'm a paragraph!</p>
195+
</body>
196+
197+
If you reload the page in your browser, you'll notice the heading has vanished.
198+
199+
Remove the comment tags (so the heading appears again) before moving on to the
200+
next section.
201+
202+
## Putting it all together
174203

175204
So far, our entire document might look like this:
176205

0 commit comments

Comments
 (0)