About Lesson
Certainly! Here’s a reference list of commonly used HTML attributes and their descriptions:
Global Attributes:
class
: Specifies one or more CSS class names to style an element.id
: Provides a unique identifier for an element.style
: Defines inline CSS styles for an element.title
: Provides additional information or a tooltip for an element.lang
: Specifies the language of the element’s content.data-*
: Allows custom data attributes to be added to elements for storing extra information.aria-*
: Defines accessible attributes for enhancing accessibility.
Hyperlink Attributes:
href
: Specifies the URL or destination of a hyperlink.target
: Specifies where to open the linked document or resource (e.g.,_blank
,_self
,_parent
,_top
).rel
: Specifies the relationship between the current document and the linked document (e.g.,stylesheet
,icon
,nofollow
).download
: Specifies that the target should be downloaded when clicked.
Image Attributes:
src
: Specifies the URL or source of an image.alt
: Provides alternative text for an image when it cannot be displayed.width
: Specifies the width of an image (in pixels or percentage).height
: Specifies the height of an image (in pixels or percentage).
Form Attributes:
action
: Specifies the URL where form data is sent when submitted.method
: Specifies the HTTP method used to submit the form (GET
orPOST
).name
: Provides a name for a form element.value
: Specifies the default value for an input element.placeholder
: Provides a short hint or example value for an input element.
Table Attributes:
colspan
: Specifies the number of columns a table cell should span.rowspan
: Specifies the number of rows a table cell should span.scope
: Specifies the scope of a table header cell (col
,row
,colgroup
,rowgroup
).headers
: Associates table cells with header cells by ID.
Input Attributes:
type
: Specifies the type of an input element (text
,checkbox
,radio
,number
,email
,date
, and more).required
: Specifies that an input field must be filled out before submitting a form.disabled
: Disables an input field.readonly
: Specifies that an input field is read-only and cannot be edited.autocomplete
: Specifies whether an input field should have autocomplete suggestions.
Media Attributes:
autoplay
: Specifies that a media element should start playing automatically.controls
: Displays media controls for a media element.loop
: Specifies that a media element should start playing again after reaching the end.preload
: Specifies how a media element should be loaded (auto
,metadata
,none
).
These are just a few examples of HTML attributes. There are many more attributes available for different HTML elements. You can refer to the HTML documentation provided by resources like Mozilla Developer Network (MDN) or W3Schools for a comprehensive list of HTML attributes and their usage.
Join the conversation