Bhylu

HTML Attributes

Attributes provide settings or extra information on an element’s opening tag. Their meaning depends on the element: href is meaningful on a link, while alt describes an image.

How it works

  • Write named values in quotes. This avoids ambiguity when a value contains spaces or punctuation.
  • Global attributes such as id, class, and lang work on most elements. Other attributes apply only to particular element types.
  • Boolean attributes are enabled by their presence. disabled="false" still disables a control; remove disabled to enable it.

A practical example

HTML

<a href="schedule.html" class="nav-link">Meeting schedule</a>
<button type="button" disabled>Registration opens soon</button>
<p lang="fr">Bienvenue au club.</p>

The link has a destination and a styling hook, the button is unavailable, and the paragraph declares a language change for its content.