What are HTML Attributes

In this article we will discuss about the attributes in HTML.
  • 2008

Attributes in HTML

Attributes are used to provide some additional information about the tag and HTML tag can contain one or more attributes. Attributes are like the properties of the tag which are used to provide the additional formatting on the content. Attributes comes with name="value" pair.

Examples of attributes are as follows:

Like <img> attributes are src, width, height etc. Here src is used to provide the source of the image. Height is used to set the height of the image. Width is used to set the width of  the image.

HTML code:

<html>
<head>
    <title></title>
</head>
<body>
    <img src="Chrysanthemum.jpg" height="30%" width="30%"></img>
</body>
</html>

 

<font> tag also have the attributes : color, size etc.

<html>
<head>
    <title></title>
</head>
<body>
    <font color="green" size="20">My name is Robert</font>
</body>
</html>

 

Output

My name is Robert

Here it is clear that color and size attributes of the font tag are changing the appearance of the text My name is Robert.

Every tag in HTML has an at least one attribute. Attributes are used to specify the characteristic of the particular tag.

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.