$type=slider$count=4$ico=1$cate=0$rm=0$sn=0$cm=0$show=home

Introducing Attributes in HTML Elements

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>
    <head>
        <title>My First HTML</title>
    </head>
    <body bgcolor="red">
        <h1>Heading 1</h1>
        <h2>Heading 2</h2>
        <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>
    <head>
        <title>My First HTML</title>
    </head>
    <body bgcolor="red">
        <h1>Heading 1</h1>
        <h2>Heading 2</h2>
        <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.

COMMENTS

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
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content