HTML Attributes

Every HTML Elements usually have attributes to it. An attribute will provide additional information to the HTML element. Attributes are written inside the start tag of any elements, and it is written as name=”value”. For Example the body element has the bgcolor attribute. Now open up the same index.html file in a text editor and add the attribute bgcolor=”red” inside the body tag as follows:

<html>
<title>My First HTML</title>
<body bgcolor="red">
<p>Hello World</p>
<p>This is a second paragraph and I'm putting <strong>Bold</strong> and <em>Emphasis</em> just to see if it works
</p>
</body>
</html>

Reload the file in your browser and you’ll see something like this below:

Here, the attribute bgcolor="red" gives an additional information telling the browser that the background color is red.

We’ll learn another Element in HTML which is used to display images. The image element start and ends with <img /> tag. As of now you’ve noticed that every element opens up as  <element>  tag and closed as </element> tag, but the image element is slightly different and doesn’t have an end tag. Now download this image into your computer and save in the same folder MyWeb. Now edit index.html again and add the following code.

<html>
<title>My First HTML</title>
<body bgcolor="red">
<p>Hello World</p>
<p>This is a second paragraph and I'm putting <strong>Bold</strong> and <em>Emphasis</em> just to see if it works
</p>
<img src="attribute.jpg" width="300" />
</body>
</html>


Here the img uses two attributes – the src and the width attribute. The former tells image element where the source of the image is? and the later tells image element about the width to be displayed. Try and experiment with the width and also height to see different results.

3/random/post-list
Name

blog,7,chemistry,7,css,1,feature,8,html,5,java-script,2,php-mysql,3,solved-qp,4,spectroscopy,3,technology,4,videos,3,web-design,13,
ltr
item
F Diengdoh.com: Introducing Attributes in HTML Elements
Introducing Attributes in HTML Elements
Every HTML Elements usually have attributes to it. An attribute will provide additional information to the HTML element. Attributes are written inside
https://1.bp.blogspot.com/-gF2TkNDYZZ8/XvYPvafK0hI/AAAAAAAARbI/_WrnvpeXpq8J9liOzmNAXgWlWyFsz1OdACK4BGAsYHg/w640-h360/attribute.jpg
https://1.bp.blogspot.com/-gF2TkNDYZZ8/XvYPvafK0hI/AAAAAAAARbI/_WrnvpeXpq8J9liOzmNAXgWlWyFsz1OdACK4BGAsYHg/s72-w640-c-h360/attribute.jpg
F Diengdoh.com
https://www.fdiengdoh.com/2015/02/introducing-attributes-in-html-elements.html
https://www.fdiengdoh.com/
https://www.fdiengdoh.com/
https://www.fdiengdoh.com/2015/02/introducing-attributes-in-html-elements.html
true
6372396504026100368
UTF-8