HTML Attribute
1. HTML attributes are special words which provide additional information about the elements or attributes are the modifier of the HTML element.
2. Each element or tag can have attributes, which defines the behaviour of that element.
3. Attributes should always be applied with start tag.
4. The Attribute should always be applied with its name and value pair.
5. The Attributes name and values are case sensitive, and it is recommended by W3C that it should be written in Lowercase only.
6. You can add multiple attributes in one HTML element, but need to give space between two attributes.
Syntax :
<element attribute_name="value">content</element>
Example :
<!DOCTYPE html>
<html>
<head>
</head>
<body> <h1> This is Style attribute</h1>
<p style="height: 50px; color: blue">It will add style property in element</p> <p style="color: red">It will change the color of content</p>
</body>
</html>
OUTPUT :
The title attribute in HTML :
Description:
The title attribute is used as text tooltip in most of the browsers. It display its text when user move the cursor over a link or any text. You can use it with any text or link to show the description about that link or text. In our example, we are taking this with paragraph tag and heading tag.
Example :
With <h1> tag:
<h1 title="This is heading tag">Example of attribute</h1>
With <p> tag:
<<p title="This is paragraph tag">Move the cursor over the heading and paragraph</p>
The href attribute in HTML
Description:
The href attribute is the main attribute of <a> anchor tag. This attribute gives the link address which is specified in that link. The href attribute provides the hyperlink, and if it is blank, then it will remain in same page.
Example
With link address:
<a href="https://wwwakashtechviews.com">This is a link</a>
The src Attribute :
The src attribute is one of the important and required attribute of <img> element. It is source for the image which is required to display on browser. This attribute can contain image in same directory or another directory. The image name or source should be correct else browser will not display the image.
0 comments:
Post a Comment