Inserting an Image

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 – signature
  • title – 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)

365

 

Image as a link

365

 

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


Share this term: Facebook X LinkedIn WhatsApp Email

Leave a Reply

Your email address will not be published. Required fields are marked *