Home >>HTML Tutorial >HTML List

HTML List

HTML Attributes

HTML Attributes are the modifier of the elements and have provide additional information about an element. It is placed inside the opening tag of the element. Each element and tag can have attribute. By using attribute you can also set the height and width.

The attributes name and values are always written in Lowercase and are case sensitive.

HTML attributes consist two parameters:

  1. Name
  2. Value
Syntax:
<element attribute_name="attribute_value">

The src Attribute

src attribute are always written inside <img> tag to display the images in the web page. Src attributes are used to specify the address of the image inside the double quotes.

Let's take an example of src attribute:
<!Doctype html>
<html> 
<head> 
	<title>Attribute</title> 
</head> 
<body> 
	<img src="1.png" alt="img"> 
</body> 
</html>
Output: img

The href attribute

href attribute is used to provide hyperlink and the link address which specified that link. It is used inside the anchor tag <a>.

Let's take an example of href attribute:
<!Doctype html>
<html> 
<head> 
	<title>Attribute</title> 
</head> 
<body> 
	<a href="https://www.phptpoint.com">This is a link</a>  
</body> 
</html>
Output: This is a link

The alt attribute

The alt attribute is used to display the alternative text, when an Image cannot be displayed in the web page.

Let's take an example of alt attribute:
<!DOCTYPE html>
<html>
<body>
<img src="1.png" alt="phptpoint" >
</body>
</html>
Output: img

The style Attribute

The style attribute is used to styling of an element, like color, background-color, font-size, border, etc.

Let's take an example of style attribute:
<!DOCTYPE html>
<html>
<body>
<p style="color:blue">This is a paragraph.</p>
</body>
</html>
Output:

This is a paragraph.


No Sidebar ads