HTML Attributes
HTML Attributes are used to provide additional information about HTML elements.
The HTML Is Written as:
The filename of the source (src), and the size of the image (width and height) are all provided as attributes.
Image size is specified in pixels: e.g . width="320" means 104 screen pixels wide.
The value of the attribute can be read by screen readers. This way, someone "listening" to the webpage, e.g. a blind person, can "hear" the element.
Its Written in this Form:
HTML Attributes
- All HTML elements can have attributes
- Attributes provide additional information about an element
- Attributes are always specified in the start tag
- Attributes usually come in name/value pairs like: name="value", Style="Value", Class="Value" e.t.c
- Attributes add Special and Dynamic effects to HTML Elements or Post Contents
The title Attribute
Here, a title attribute is added to the <p> element. The value of the title attribute will be displayed as a tooltip when you mouse over the paragraph:The HTML Is Written as:
<p title="I'm a tooltip"> This is a paragraph. </p>
The href Attribute
HTML links are defined with the <a> tag. The link address is specified in the href attribute, They Can be used with Some Css elements to gain special effects:
E.G:
<a href="http://wapcircles.blogspot.com">This Wapcircles Blog link</a>
The lang or Language Attribute
The language of the document can be declared in the <html> tag.
The language is declared with the lang attribute.
Declaring a language is important for accessibility applications (screen readers) and search engines:
Size Attributes
HTML images are defined with the <img> tag.The filename of the source (src), and the size of the image (width and height) are all provided as attributes.
Image size is specified in pixels: e.g . width="320" means 104 screen pixels wide.
The alt Attribute
The alt attribute specifies an alternative text to be used, when an image cannot be displayed.The value of the attribute can be read by screen readers. This way, someone "listening" to the webpage, e.g. a blind person, can "hear" the element.
Its Written in this Form:
<img src="wapcircles_logo.jpg" alt="wapcircles.blogspot.com" width="104" height="142">
Page Summary: Common Html Attributes used in HTML
The Attributes | Description |
---|---|
alt | Specifies an alternative text for an image, when the image cannot be displayed |
href | Specifies the URL (web address) for a link |
id | Specifies a unique id for an element |
src | Specifies the URL (web address) for an image |
style | Specifies an inline CSS style for an element |
title | Specifies extra information about an element (displayed as a tool tip) |