- Basics of HTML Introduction to HTML
- HTML5 Elements Semantic Page Elements
- HTML5 Form New Form Elements
- HTML Graphics HTML5 Canvas
How to start
HTML CHAR formatting
HTML Layout tags
HTML Character Encoding
Semantic Inline Elements
Form Element Attributes
New Input types
Mon, 10 Feb, 2014
HTML attributes are similar to metadata(data about data). They give useful information about the HTML elements.
In below html, hyperlink tag has an attribute href that is telling the destination, where you will be redirected after clicking on it.
HTML Attribute Structure
HTML Attributes are always included in starting tag.
Attributes always have some value that tells the additional information in context of an element. e.g. <tag attribute:value></tag>
Attribute values are always placed inside single or double quotes, in HTML5 we can give attribute value without quotes.
Attributes common to most of the tags are discussed below:
Its a unique identifier for an element within a webpage.
e.g. if you want to give specific portion of your webpage a different style OR
You want script(s) to pick data from specific portion with a fixed name then use the id attribute.
if you want to give a similar style/property to multiple portions of your website you can assign class attribute appropriately. e.g.
this is first block of my page.
this is second block of my page.
NOTE: For accessing elements with id and class in css use the (#) and (.) dot property appropriately.