Skip to main content

How to Add Image in HTML Website

In this tutorial, we are going to show you how to add an image in HTML website.

<img> tag is used to display image in the document. It has no ending tag. It is an empty tag.The attribute of <img> tag is as follows.

Attributes of <img> tag



Attributes
Value
Description
Src
Path.
The path of the image.
Width
Value in pixels or %.
Sets the width of the image.
Height
Value in pixels or %.
Sets the height of the image.
Alt
Text.
To display the alternate text.
Hspace
Value in pixels.
To set the horizontal spacing in pixels or percentage.
Vspace
Value in pixels.
To set the vertical spacing in pixels or percentage.
Align
Left
Right
Top
Middle
Bottom
Absbottom   (absolute bottom).
To set the alignment of the image.
Border
Value in pixels or percentage.
Specifies the width of the images border.

Now. lets insert image in the html document.

Add Image In HTML Web Page 


<html>
<head>
<title>
image tag
</title>
</head>
<body>
<img src="C:\Users\Public\Pictures\Sample Pictures\Lighthouse.jpg" width=200 height=200>
</body>
</html>

Output is


In the above example you have seen image with attribute width and height. 



NEXT

Comments

Popular posts from this blog

Lists in HTML - Unordered List

Unordered List An Unordered List is a collection of item that is not  in sequential order. It starts with the <ul> tag and ends with the </ul> tag. Each list item starts with the <li> tag. Each item is marked with the bullet i.e . with the disc or square or circle.  By default the tag starts with the disc . It is also called Bulleted list. Tags of Unordered List <ul> </ul> <li></li> Example    Write a  program to print the list given below pen pencil book <html> <head> <title> unordered list </title> </head> <body> <ul> <li>pen</li> <li>pencil</li> <li>book</li> </ul> </body> </html> Example of Attributes of <ul> tag with the Type attributes Write a program to print the list given below <html> <head> <title> unordered list </title> </head...

Lists in HTML

List Today we are going  to  talk about the List. Question arises what is List ? A list is a collection of items. There are five types of list in HTML They are defined  below Ordered List Unordered List Directory List Definition List Menu List Ordered List  If you want to display items in a numbered  list  like 1,2,3,... or A,B,C... or i,ii,iii.... or I,II,III... or a,b,c....... Ordered List starts with the <ol> tag and ends with the </ol> tag. Each item starts with the <LI> tag. It is also called the Numbered List. Tags of Ordered List <ol></ol> <li></li> Attributes of Ordered List Attributes Value Description Type “1” or “I”  or “I” or  “a”  or ”A”  It specifies type of numbering's. By default the numbering Start Value To specify the starting point of the numbering. Example <html> <head> ...

HTML FRAMES - HTML Frames Example with Output

Post Updated :16-02-2018 HTML Frames is used to display more than one file. It is used to divides the browser window into different parts or sections  i.e.  row-wise or column-wise or row and column-wise . Each section can display HTML files.To create a frame  two tags are used they are <frameset> and <frame> tag. Attributes of  <frameset>    tag 1. Cols=value is % or pixels 2. Rows= values in % or pixels Attributes of <frame> tag 1. Src= "path" 2. Name="name of the frame" 3. Border= value in pixels 4. Noresize 5. Scrolling="true" or "false" 6. Marginwidth=value in % or pixels 7. Marginheight=value in % or pixels If I want to divide the browser into two columns. The following example will be used to divide the window into 2 section. In the example given below we are using to divide the browser into equal sections i.e. 50% each. HTML Frames Example with Output Simple example of two- framed page ...