Why do certain tags start with brackets <> on each side while others only start with one <

There are certain tags such as paragraph (“< p >”) that starts with both brackets and end with both brackets

while others such as anchor (<a) that starts with one bracket on the side but then is either closed with another bracket on one side (for example the comment tag ) or on both (< /a>).

How do you determine when tags have both brackets or one on the side when opening and closing elements?

[Note – I added spaces in the tags shown otherwise it wouldn’t appear in the post. I know they’re not supposed to be there during coding]

I’m having trouble following you.

The following is a valid p paragraph element.

<p>This is a paragraph</p> 

This is an anchor tag.

<a href="https://forum.freecodecamp.org">A link to FreeCodeCamp</a> 

img (image) elements have no end tags. There’s a whole list of them over here. And here is the list in case the page is lost. The reason why they are that way is because they can’t have child nodes.

2 Likes

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