Attribute
previous Next- All HTML elements can have attributes.
- Attributes provide additional information about elements or attributes are the modifier of the HTML element.
- Attributes are always specified in the start tag.
- Attribute usually come in name/value pairs like : name="value".
- The attributes name and values are case sensitive.
- You can add multiple elements in one HTML elements,but need to give space between two attributes..
There are some of the most commonly used Attributes in HTML.
- HTML src Attribute
- HTML alt Attribute
- HTML width and height Attribute
- HTML id Attribute
- HTML title Attribute
- HTML href Attribute
- HTML style Attributes
- HTML lang Attributes
1. HTML src Attribute
- The src attributes of specifies the path to the image to be displayed.
- The src attribute is one of the important and required attribute of element.
- The <img> tag is used to embed an image in an HTML page.
- This attribute can contain image in same directory or another directory.
1. HTML alt Attribute
The required alt attribute for the tag specifies on alternate text for an image, if the image for some reason cannot be displayed.
This can be due to slow connections , or an error in the src attribute , or if the user uses a screen reader.
1. HTML alt Attribute
The required alt attribute for the tag specifies on alternate text for an image, if the image for some reason cannot be displayed.
This can be due to slow connections , or an error in the src attribute , or if the user uses a screen reader.
3. HTML width and height Attribute
The height and width attributes of provide size information for image.
4. HTML id Attribute
This attribute is used to provide a unique identification to an element.In that case , we provide different to various elements so that they can be uniquely accessed. The properties extending the use of id are generally used in CSS , which we will be learning later.
5. HTML title Attributes
The title attribute defines some extra information about an element.
For example -If you add a (paragraph) tag , then as soon as you mouse over that paragraph element , the title value will appear.
6. HTML href Attribute
This attribute is used to specify; a link to any address. The href attribute is the main attribute of anchor tag. This attribute gives the link address which is specified in that link . The attribute provides the hyperlink , and if it is blank , then it will remain in same page.
7.HTML style Attribute
The attribute is used to add styles to an element , such as color , font , size and more.HTML may style attribute is used inside the start tag. You can call it inline style.
8. HTML lang Attribute
The lang attribute of the tag declares the language of the web page. This is meant to assist search engines and browsers .The language is declared with the lang attribute.
