Regarding anchor elements


#1

Hello World!

So far I've had a great time learning HTML for the first time but I'm having trouble understanding why the angle bracket in the anchor element is open when adding a link.

Example: < a href="https://www.wikipedia.org/">This Is A Link To Wikipedia< /a>

Why isn't the angle bracket closed at the opening tag, and why is there another angle bracket right after the link?

https://www.codecademy.com/courses/learn-html-css/lessons/common-elements/exercises/links?action=lesson_resume

```

Replace this line with your code.

<do not remove the three backticks above>

#2

anchor elements are not very different from paragraph elements:

<a>hello</a>
<p>world</p>

only difference is that we add an attribute (href) to the opening tag of the anchor element

which angle bracket are you referring to? we have four: lesser then (<), greater then (>) at the opening tag and same at the closing tag


#3

I was referring to the (>) angle bracket in the opening tag. Shortly after posting this I realized exactly what you said, the (href) attribute is added inside the opening tag of the anchor element. Same as an (src) attribute is added directly inside an element… but you knew that


#4

yep, seems you understand now as well, > didn’t come out of the blue, the attribute is simply added inside the opening tag (so before the > which closes a tag, in this case the opening tag)

this applies to all attributes


#5

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