Understanding HTML Attributes
Attributes provide additional information about HTML elements. They are always specified in the opening tag.
Attributes usually come in name/value pairs like: name="value"
<!-- Common attributes -->
<a href="https://example.com" title="Visit Example" target="_blank">Link</a>
<img src="image.jpg" alt="Description" width="300" height="200">
<div id="header" class="container main-header" style="color: blue;">
Content
</div>
<input type="text" name="username" placeholder="Enter username" required>
- id - Unique identifier for an element
- class - One or more class names for styling
- style - Inline CSS styles
- title - Tooltip text
- href - Link destination (for )
- src - Source file (for
,