Skip to content

Tags, attributes, and comments in HTML

May 26, 2020
You will learn what you need to know about the ⭐ LABELS, ATTRIBUTES and COMMENTS ✅ in HTML explained to 100%. ⭐ ENTER!

In this post we will teach you what you need to know about tags, attributes and comments in HTML. ENTERS!

WE START:

Welcome to another post.

We will see some basic tools for creating a web page; We talk about what are HTML tags and comments and attributes.

These are too important when developing the site, since literally the site structure it depends on at least the tags and attributes. We will explain all this very clearly. Let's go!

HTML tags

An HTML tag it is basically a statement that is given to the code to open a new statement.

Each label has an opening and a closing, and between these two declared labels, is where the sentence or instruction to be executed will go.

An opening tag is accompanied by less what ("<") and greater what (">"), and in between is the name of the statement.

On the other hand, a closing tag is accompanied by the same as the opening tag, with the only difference that after the minor what tag ("<"), a slash ("/") is declared.

List of the most common HTML tags.
List of the most common HTML tags.

Let's see an example in order to clarify any doubts:

Suppose we want to instruct the browser that write the following text: "I'm learning the basics of HTML tags."

For it, the label called "p" is used, which for its English translation, would be "paragraph" (paragraph). So, it would be placed like this:

I'm learning the basics of HTML tags

The first tag is the opening; the second, putting the slash ("/"), would be the closing of the same instruction; and what is in the middle of both is what will do.

Attributes in HTML

HTML attributes they are the way to make the language understand the properties of a label.

These properties interpret the element on the web pageThese are usually letters, numbers, or a word. It depends on the labels is the change that the text will receive.

Explanation of the attributes in HTML.
Explanation of the attributes in HTML.

Let's take an example with the tag

:

Suppose we want align text to the right. For that we will have to use the attribute «style» (style in Spanish), and inside it, place that instruction:

I am learning the attributes of a tag in HTML.

As we can see, the attribute statement is between = »».

There are many more attributes, but you will discover that as time goes by in your learning in this layout language.

We recommend you:  Links, absolute and relative paths in HTML

Comments in HTML

A comment does not affect what the end user sees on your website.

It is to place a comment text in your site's HTML code, which the user will not be able to see at all, unless, as you already know, he accesses the source code of the site and sees it; but these users are more experienced than a normal surfer, so to speak.

Commonly a comment is used in the HTML of a website to be able to place certain actions of the progress or advance of the same, or to describe certain functionality of the website.

This estructure is the next one:


What we want to comment on is placed between those special HTML tags.

Explanation of comments in HTML.
Explanation of comments in HTML.

How could we bring this to real life? Well, very simple:

We return to the example of the label

, applying the comments inside the HTML:


It's that simple, the naked eye will not see it. You have done well!

Important note
Do not place HTML comments that indicate things internal to the site that may harm the security of the site or your users. Note that these comments can be seen by people who also know HTML and access the source code of your website.

I hope this article has been very helpful. In this site we talk more about HTML and everything you have to know to create a site. Visit us!

We also have a developer category which we talk about all kinds of things about programming. Check out!

Did you understand HTML tags, attributes and comments well? Leave us your opinion below in the comments!

See you in another article.