<?xml version="1.0" encoding="utf-8"?>

HTML attributes

All HTML elements have attributes — modifiers that either specify how the element works or add additional functionality. They go inside the start tag.

The <img> tag is one of the examples of HTML tags that can be modified with attributes. The <img> tag is used for embedding pictures and requires an src attribute that specifies the picture's path. It's a required attribute because, without it, the browser won't be able to display the image.

On the other hand, style is an optional attribute. For example, by default, the body text is black. But if you add a style="color:red;" to the paragraph tag <p>, the text color changes to red.

Improve your UX & Product skills with interactive courses that actually work