Що є атрибутами у наведеному HTML-коді

What Are Attributes in HTML Code? A Simple Guide

If you are trying to understand what attributes are in HTML code, the simplest answer is this: they are extra name=”value” pairs that define how an HTML element behaves or looks. They are written inside the opening tag and are not the tag itself or the text on the page.

How attributes look in HTML

In a typical HTML line, attributes come after the tag name. For example, in <a href=”https://example.com” target=”_blank”>, the attributes are href and target. The first one sets the link destination, and the second controls how it opens.

So, an attribute is not a separate part of the page. It is syntax that gives the browser extra instructions.

How to tell an attribute from a tag and content

To avoid confusing the main parts of HTML, it helps to remember three things:

  • Tag — the name of the element, such as p, a, img, or div.
  • Attribute — a property of the element, such as href, src, alt, class, or id.
  • Content — what sits between the opening and closing tags, such as paragraph text.

For example, in <img src=”photo.jpg” alt=”Portable laptop”>, the tag is img, the attributes are src and alt, and there is no content inside because the image element is self-closing.

The most common attributes you should know

In basic HTML markup, these attributes appear most often:

  • href — the address of a link;
  • src — the path to an image, video, or other resource;
  • alt — alternative text for an image;
  • class — a CSS class used for styling or selecting an element;
  • id — a unique identifier for an element;
  • title — a tooltip that may appear on hover.

These attributes do not change the overall structure of the HTML document, but they do affect how an element behaves, displays, or is interpreted.

What counts as attributes in the given code

When you get a question like what attributes are in the given HTML code, look for the parts after the tag name that follow the pattern name=”value”, or sometimes just name in special cases. Those are the attributes.

For example, in <input type=”text” name=”email” disabled>, the attributes are type, name, and disabled. Here, disabled is a boolean attribute, which works simply by being present.

Practical takeaway

To identify attributes in HTML quickly, do not focus on the tag itself or the text between tags. Look at the extra details inside the opening element. They tell the browser what to show, where a link should go, which file to load, or how to style a block.

Once you read HTML in parts, attributes become easy to understand: the tag names the element, the attribute adds detail about its behavior, and the content is what the user sees on the page.