HTML Attributes – HTML Tutorial
This HTML-Attributes post providing complete information about HTML attributes and its elements including what is attribute or property of HTML element and need to of attribute, how to write attributes while defining HTML elements and much more.
- Attributes are used to give some additional meaning to content encapsulated by its element.
- Attributes consists two parts
- Attribute name and value must be separated with is equal to (=) sign.
- Attributes must be declared inside the opening tag of an element.
- A single element can contain 0 or number of attributes.
- If an element contains more than one attribute, then those attributes must be separated by a space character.
- Here ‘bgcolor’ is the attribute with a value to change the background of the web page.
<body bgcolor=’red’ >
Note : <marquee> tag is used to scroll the text on the screen from RIGHT to LEFT.
<img src=”……\cutebaby.jpg” width=”200″ title=”Cute” alt=”baby picture not available”>
- Here “src” is the attribute of the <img> tag to display the image on the webpage.
- Using”src” we can provide the path of the image to display.
- “title” attribute is to set the title to that image, and that title will appear while we are moving the cursor on that particular image.
- The “alt” attribute provides alternative information for an image if a user for some reason cannot view it (because of slow connection, an error in the src attribute).