Different Types Of Html Attributes

admin_img Posted By Bajarangi soft , Posted On 27-09-2020

The 'img' tag is used to embed an image in an HTML page. The 'src' attribute specifies the path to the image to be displayed,'src' attributes we can add the width and height to the images using style attribute,'alt' attributes used to alternate text for an image,and also you should include 'lang' attribute inside the html tag declare the language of the web page

src Attributes

1.Create a Attribute 'src' Example

<!DOCTYPE html>
<html>
<body>

<h2>The alt Attribute</h2>
<p>The alt attribute should reflect the image content, so users who cannot see the image gets an understanding of what the image contains:</p>

<img src="my_pic.jpg" alt="a boy  with a jacket" width="500" height="600">

</body>
</html>

2.Create a Attribute 'lang' Example

<!DOCTYPE html>
<html  lang="en-us">
<body>

<h2>The alt Attribute</h2>
<p>The alt attribute should reflect the image content, so users who cannot see the image gets an understanding of what the image contains:</p>

<img src="my_pic.jpg" alt="a boy  with a jacket" width="500" height="600">

</body>
</html>

3.Create a Attribute 'style' Example

<!DOCTYPE html>
<html>
<body>

<h2>The style Attribute</h2>
<p>The style attribute is used to add styles to an element, such as color:</p>

<p style="color:red;">This is a red paragraph.</p>

</body>
</html>

Related Post