Attributes of HTML

More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test

HTML attributes provide additional information about its element

attribute-pic here

We are now ready to learn the most important part of HTML that is called attribute.
HTML Attributes provide additional information about its element.
Attributes generally come in a pair (Name and Value) like:
<h1 align="center"> Heading One </h1>
Attributes are always used to apply in the opening tag like:
<a href="http://www.facebook.com"> Facebook </a>

Example of Attributes:


HTML Editor

<!DOCTYPEhtml >
<html lang= "en-US">
<body>
<p title="About Designhome"> Designhome is a wonderful site for begeiner, you can learn all about webdesign and general knowledge of HTML, CSS even Basic GK here. </p>
<a href="http://www.facebook.com"> Facebook </a>
<img src="images/html-5.png" alt="image" width="284" height="177"/>
</body>
</html>

Web Browser

Designhome is a wonderful site for begeiner, you can learn all about webdesign and general knowledge of HTML, CSS even Basic GK here.



Facebook



image

Lang Attribute:
<html lang="en-US">= By this way you could declare the document language and the "lang" attribute is important for search engines.

Title Attribute:
<p title="About Designhome">=In the HTML document, <p> tag defines paragraph. Here, the <p> element has a "title" attribute and "About Designhome" is the value of this attribute. The value of this attribute will be displayed as a tooltip, if the mouse moves over the element.

Href Attribute:
<a href="http://www.facebook.com"> Facebook </a>= In the HTML document, "href" attribute makes a link with the
anchor <a> tag to another page. The link address is specified by the "href" attribute. We will discuss more about links and the anchor <a> tag later in this tutorial.

Alt and Size Attribute:
<img src="images/html-5.png" alt="image" width="284" height="177"/>= In the HTML document, you can insert images (jpg, png, gif) with the <img> tag. Remember, there is no closing tag in the <img> tag. The filename of the source is defined with the "src" attribute and the size of the image (width and height) are defined with the size attributes. When an HTML element cannot be displayed, an alternative text then to be used by the "alt" attribute.

Some HTML Attributes

Here is a list of some attributes often used in HTML:


Attribute Description
alt Specifies an alternative text for an image
href Specifies the URL (web address) for a link
src Specifies the URL (web address) for an image
style Specifies an inline CSS style for an element
title Specifies extra information about an element (displayed as a tool tip)


More options for you.


General KnowledgeEnglish GrammarMathScienceIQ-TestQuiz-Test