As in the previous tutorials, we have been discussed about HTML Elements. Now we are going to discuss HTML Attribute.
All the HTML Elements have some attribute. The attribute of any element can be specified with the name and their value as shown in the below example. The attribute may have also globally scope that can be used in any place in the supported Elements.
Following is the example is shown <P> Elements have a title attribute in which the named of the attribute is Title and their value is About us.[mks_pullquote align=”left” width=”848″ size=”15″ bg_color=”#c3f977″ txt_color=”#2d2d2d”]Example:Â <p title=â€About usâ€> My name is Abdul Jabbar. I am SEO Experts </p>[/mks_pullquote]
The attribute can be specified in the start tag and cannot be used in end tag.
An attribute of image Elements is used to the specified directory of an image where the image exists. And Alt attribute of an image is used to display the name of the image when an image does not exist.[mks_pullquote align=”left” width=”848″ size=”15″ bg_color=”#c3f977″ txt_color=”#2d2d2d”]Example:Â <img src = â€c:window/name.jpgâ€ alt = â€œ stack of tuts LOGO â€>[/mks_pullquote]
Custom Attribute named to start with Data and Then next named of Attribute is according to your requirements. The syntax of the Custom Attribute shown in the following example.[mks_pullquote align=”left” width=”848″ size=”15″ bg_color=”#c3f977″ txt_color=”#2d2d2d”] Example:Â <div Â class = â€data-exampleâ€ data-subject = â€œPhysicsâ€ Data-level = â€œComplexâ€> ……… Â </div>[/mks_pullquote]
Example Program of Video
<!DOCTYPE html> <html> <head> <title> Attribute</title> </head> <body bgcolor="pink"> <p title="About us" align="center" style="color:green;">MY name is Abdul jabbar. I am a web developer and SEO Experts. </p> </body> </html>
Detailed of Program
- The following program, in the < body > Element bgcolor attribute is used to specified what color of the page in the background place. You can also change the bodyâ€™s color according to your interest.
- Align = â€œcenterâ€ this attribute is used to specify the position of the paragraph where we want to display.
- Style = â€œcolor:greenâ€ This attribute is used for inline CSS ( Cascading Style Sheet ). With inline CSS you can also change everything that is related to specified HTML Elements.