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

CSS How to Make a Website Beginning HTML and CSS Introduction to HTML and the Portfolio Project

Is it necessary to add a forward slash (</h1>) when closing the bracket, or could you do without it?

Does typing a forward slash make a difference?

3 Answers

You know if you don't close it? Everything will be messed up and browser will eventually mess it up : p it may forgive you some of it but not long. You have to do it. its a rule really . you open it with <h> and close every tag with the slash. There is na exception on <img > where you don't close it. Look at my code how i do it.

http://scr.hu/2icp/a0qy0

I hope you get the idea .

the code is quite old so please don't point out ^^

Ok, thank you sir :)

This is my first time in the forum and appreciate the responses.

Im glad it helped.

For better usage of forum you could also :

  • Watch the video on the right that says " Tips for asking questions ";
  • Put an UP vote on answer that helped you and DOWN vote on answers that veer ( basically wrong).
  • Put Best Answer to help other to choose what helped .

If you will have problem with your code post . I will write you an edit and you could check how i did it to achieve the effect of the highlighted code ^^

Yes, the forward slash tells the browser that the contents inside the tag should no longer be affected by that particular tag. Otherwise, the browser would not know which tags are opening tags and which as closing tags.

Ok, so closing a tag without a forward slash would be the same as having two opening tags. Correct?

Daniel Nora
Daniel Nora
2,550 Points

That is correct, Melissa. You can verify that by opening an h1 tag, entering some text, opening another h1 tag (instead of closing it) and then entering some more text after. If the h1 tag had been properly closed, the text coming after the second h1 tag (which should actually be a closing tag) wouldn't be in such a large font size. However, since the browser doesn't know that you want the h1 tag to be closed, it just displays the text "outside" of it as a headline too.

very necessary