# Commenting out on HTML

**URL:** <https://forum.freecodecamp.org/t/commenting-out-on-html/449596>\
**Category:** Curriculum Help\
**Tags:** html, css\
**Created:** [March 4, 2021, 4:29pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596 "2021-03-04T16:29:02Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwogwugwudavid1995](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nwogwugwudavid1995/32/182457_2.png) [@nwogwugwudavid1995](https://forum.freecodecamp.org/u/nwogwugwudavid1995)\
**Post date:** [March 4, 2021, 4:29pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/1 "2021-03-04T16:29:03Z")

</div>

**Tell us what’s happening:**  
i am having difficulty in commenting out on HTML  
**Your code so far**

```auto
<h1>Hello World</h1>

<!--CatPhotoApp-->

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff</p>

```

```html

<!--CatPhotoApp-->.
<h2>CatPhotoApp</h2>

```

**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.190 Safari/537.36`.

**Challenge:** Comment out HTML

**Link to the challenge:**

> **[freeCodeCamp.org](https://www.freecodecamp.org/learn/responsive-web-design/basic-html-and-html5/comment-out-html)**
>
> Learn to Code — For Free

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 4, 2021, 4:29pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/2 "2021-03-04T16:29:45Z")

</div>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 4, 2021, 4:31pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/3 "2021-03-04T16:31:03Z")

</div>

In the initial code, the comment tags are being used differently that you are using them

```auto
<!--
<h1>Hello World</h1>

<h2>CatPhotoApp</h2>

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
-->

```

The comment tags are on the first and last lines. You need to add additional comment tags so that only your h1 and p elements are commented out.

---

<div class="post-metadata">

**Author:** ![nwogwugwudavid1995](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nwogwugwudavid1995/32/182457_2.png) [@nwogwugwudavid1995](https://forum.freecodecamp.org/u/nwogwugwudavid1995)\
**Post date:** [March 4, 2021, 4:34pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/4 "2021-03-04T16:34:00Z")

</div>

an example will be appreciated, i am a total beginner pls. thank you

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 4, 2021, 4:36pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/5 "2021-03-04T16:36:17Z")

</div>

There is an example of using the comment tags in the starter code. What part can I clarify?

The comment tags are `<!--` and `-->`.

---

<div class="post-metadata">

**Author:** ![nwogwugwudavid1995](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nwogwugwudavid1995/32/182457_2.png) [@nwogwugwudavid1995](https://forum.freecodecamp.org/u/nwogwugwudavid1995)\
**Post date:** [March 4, 2021, 4:40pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/6 "2021-03-04T16:40:27Z")

</div>

do you use the comment tags while commenting IN and OUT an HTML ?

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 4, 2021, 4:41pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/7 "2021-03-04T16:41:27Z")

</div>

Yep. The `<!--` starts the area of the code that is commented out, and then the comment ends when you add `-->`.

---

<div class="post-metadata">

**Author:** ![nwogwugwudavid1995](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nwogwugwudavid1995/32/182457_2.png) [@nwogwugwudavid1995](https://forum.freecodecamp.org/u/nwogwugwudavid1995)\
**Post date:** [March 4, 2021, 4:52pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/8 "2021-03-04T16:52:13Z")

</div>

Understood that sir, thank you.  
i have three elements which are h1,h2 and p; i was asked to comment out my h1 and p. been trying my way round it all day. please help out sir

---

<div class="post-metadata">

**Author:** ![JeremyLT](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jeremylt/32/291894_2.png) [@JeremyLT](https://forum.freecodecamp.org/u/JeremyLT)\
**Post date:** [March 4, 2021, 4:54pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/9 "2021-03-04T16:54:04Z")

</div>

Well, you need to add a `-->` and a `<!--` so that the comment that starts around the h1 tag does not include the h2 tag and you make a separate comment around the p tag.

```auto
<!--
<whatever you want commented>
-->
<whatever you don't want commented>

```

---

<div class="post-metadata">

**Author:** ![nwogwugwudavid1995](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/nwogwugwudavid1995/32/182457_2.png) [@nwogwugwudavid1995](https://forum.freecodecamp.org/u/nwogwugwudavid1995)\
**Post date:** [March 4, 2021, 5:04pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/10 "2021-03-04T17:04:37Z")

</div>

thank you so much sir 🙂

---

<div class="post-metadata">

**Author:** ![rameshkmunjal](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/rameshkmunjal/32/235338_2.png) [@rameshkmunjal](https://forum.freecodecamp.org/u/rameshkmunjal)\
**Post date:** [March 10, 2021, 1:20pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/11 "2021-03-10T13:20:39Z")

</div>

As i understand from the problem statement in the link given, you have to comment out h1 and p element but not h2.

Hence you should place the code inside comment out signs as under

## CatPhotoApp

Hope it solves your problem

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [March 10, 2021, 1:55pm UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/12 "2021-03-10T13:55:02Z")

</div>

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (`</>`) to add backticks around text.

 ![Pre-formatted-text](https://global.discourse-cdn.com/freecodecamp/original/3X/1/b/1b18854f1059217f29370444396145cc3a0cd8ae.gif)

See [this post](https://forum.freecodecamp.org/t/forum-code-formatting/25574) to find the backtick on your keyboard.  
**Note:** Backticks (`) are not single quotes (’).

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [September 9, 2021, 1:55am UTC](https://forum.freecodecamp.org/t/commenting-out-on-html/449596/13 "2021-09-09T01:55:08Z")

</div>

Closed on September 9, 2021, 1:55am UTC

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.
