Inserting an Image
Jump to Section:
HTML Lesson 4: Inserting an Image
Lesson objective: to introduce the possibilities of placing images in HTML
Placing an image in HTML
Image formats for posting on the website: .gif, .png-8, .png-24, .png-32, and .jpg (jpg is used if a high-quality photo is required)
Syntax:
< img src = "file_name" >
img— an inline element with replaced content- The image file must be located in the same directory as the web page; otherwise, the attribute
srcmust specify the path to the file.
Example: place on page:
- prob.gif image, the file of which is located in the folder with the page,
- banner.gif image, the file of which is located in the folder one level above the current page (you need to exit the folder),
- Image from https://www.istockphoto.com/ban.jpg
Execution:
< html > ... < body > < p >< img src = "prob.gif" > < p >< img src = "../banner.gif" > < p >< img src = "https://www.istockphoto.com//ban.jpg" > < / body >< / html > |
img tag attributes
alt– signaturetitle– pop-up signature
Vertical alignment:
align="top"align="middle"align="bottom"
Horizontal alignment:
align="left"align="right"width— width (value in pixels)height— height (value in pixels)border— frame (value 0 or 1)

Image as a link

Page background image
Syntax:
< body background = "fon.gif" > |
The image will be replicated across the entire page. The value of the attribute will make the background static while the page is scrolled.bgproperties fixed
Explore More IT Terms
A
B
C
D
E
F
H
K
W
- What are databases, and why do they need DBMS and SQL?
- What do Linux distributions consist of?
- What is a GPU in a computer, in simple terms?
- What is Linux? The History of Linux
- What is the OSI Model: A Complete Explanation of the Seven Layers and Their Role in Networking
- Which Linux distribution should you choose? A Linux distribution overview
