KEMBAR78
Html images syntax | PPTX
HTML Images Syntax
BY.: TR. MJ FERNANDEZ
JOY IN LEARNING SCHOOL INC.
HTML Images Syntax
 In HTML, images are defined with the <img> tag.
 The <img> tag is empty, it contains attributes only, and
does not have a closing tag.
 The src attribute specifies the URL (web address) of the
image:
The alt Attribute
 The alt attribute provides an alternate text for an image, if
the user for some reason cannot view it (because of slow
connection, an error in the src attribute, or if the user uses a
screen reader).
 The value of the alt attribute should describe the image:
The alt Attribute If a browser cannot find an image, it will
display the value of the alt attribute:
The alt Attribute If a browser cannot find an image, it will
display the value of the alt attribute:
Image Size - Width and Height
Image Size - Width and Height
Alternatively, you can use
the width and height attribute
s:
Alternatively, you can use
the width and height attributes:
The width and height attributes always
defines the width and height of the image in
pixels.
Width and Height, or Style?
The width, height, and style attributes are valid in HTML.
However, we suggest using the style attribute. It prevents styles sheets from changing the
size of images:
Width and Height, or Style?
The width, height, and style attributes are valid in HTML.
However, we suggest using the style attribute. It prevents styles sheets from changing the
size of images:
Images in Another Folder
If not specified, the browser expects to find the image in the same folder as the web page.
However, it is common to store images in a sub-folder. You must then include the folder
name in the src attribute:
Images on Another Server
Some web sites store their images on image servers.
Actually, you can access images from any web address in the world:
Animated Images
HTML allows animated GIFs:
Image as a Link
To use an image as a link, put the <img> tag inside the <a> tag:
Image Floating
Use the CSS float property to let the image float to the right or to the left of a
text:
Image Floating
Use the CSS float property to let the image float to the right or to the left of a
text:
Image Maps
The <map> tag defines an image-map. An image-map is an image with clickable areas.
In the image below, click on the computer, the phone, or the cup of coffee:
The name attribute of
the <map> tag is
associated with
the <img>'s usemap
attribute and creates a
relationship between the
image and the map.
The <map> element
contains a number
of <area> tags, that
define the clickable
areas in the image-map.
Image Maps
Background Image
To add a background image on an HTML element, use the CSS property background-image:
The HTML <picture> Element
HTML5 introduced the <picture> element to add more flexibility when specifying
image resources.
The <picture> element contains a number of <source> elements, each referring
to different image sources. This way the browser can choose the image that
best fits the current view and/or device.
Each <source> element have attributes describing when their image is the most
suitable.
The browser will use the first <source> element with matching attribute values,
and ignore any following <source> elements.
The HTML <picture> Element
Chapter Summary
•Use the HTML <img> element to define an image
•Use the HTML src attribute to define the URL of the image
•Use the HTML alt attribute to define an alternate text for an image, if it cannot be
displayed
•Use the HTML width and height attributes to define the size of the image
•Use the CSS width and height properties to define the size of the image
(alternatively)
•Use the CSS float property to let the image float
•Use the HTML <map> element to define an image-map
•Use the HTML <area> element to define the clickable areas in the image-map
•Use the HTML <img>'s element usemap attribute to point to an image-map
•Use the HTML <picture> element to show different images for different devices
REFERENCE:
HTML IMAGES
https://www.w3schools.com/html/html_images.asp

Html images syntax

  • 1.
    HTML Images Syntax BY.:TR. MJ FERNANDEZ JOY IN LEARNING SCHOOL INC.
  • 2.
    HTML Images Syntax In HTML, images are defined with the <img> tag.  The <img> tag is empty, it contains attributes only, and does not have a closing tag.  The src attribute specifies the URL (web address) of the image:
  • 3.
    The alt Attribute The alt attribute provides an alternate text for an image, if the user for some reason cannot view it (because of slow connection, an error in the src attribute, or if the user uses a screen reader).  The value of the alt attribute should describe the image:
  • 4.
    The alt AttributeIf a browser cannot find an image, it will display the value of the alt attribute:
  • 5.
    The alt AttributeIf a browser cannot find an image, it will display the value of the alt attribute:
  • 6.
    Image Size -Width and Height
  • 7.
    Image Size -Width and Height Alternatively, you can use the width and height attribute s:
  • 8.
    Alternatively, you canuse the width and height attributes: The width and height attributes always defines the width and height of the image in pixels.
  • 9.
    Width and Height,or Style? The width, height, and style attributes are valid in HTML. However, we suggest using the style attribute. It prevents styles sheets from changing the size of images:
  • 10.
    Width and Height,or Style? The width, height, and style attributes are valid in HTML. However, we suggest using the style attribute. It prevents styles sheets from changing the size of images:
  • 11.
    Images in AnotherFolder If not specified, the browser expects to find the image in the same folder as the web page. However, it is common to store images in a sub-folder. You must then include the folder name in the src attribute:
  • 12.
    Images on AnotherServer Some web sites store their images on image servers. Actually, you can access images from any web address in the world:
  • 13.
  • 14.
    Image as aLink To use an image as a link, put the <img> tag inside the <a> tag:
  • 15.
    Image Floating Use theCSS float property to let the image float to the right or to the left of a text:
  • 16.
    Image Floating Use theCSS float property to let the image float to the right or to the left of a text:
  • 17.
    Image Maps The <map>tag defines an image-map. An image-map is an image with clickable areas. In the image below, click on the computer, the phone, or the cup of coffee: The name attribute of the <map> tag is associated with the <img>'s usemap attribute and creates a relationship between the image and the map. The <map> element contains a number of <area> tags, that define the clickable areas in the image-map.
  • 18.
  • 19.
    Background Image To adda background image on an HTML element, use the CSS property background-image:
  • 20.
    The HTML <picture>Element HTML5 introduced the <picture> element to add more flexibility when specifying image resources. The <picture> element contains a number of <source> elements, each referring to different image sources. This way the browser can choose the image that best fits the current view and/or device. Each <source> element have attributes describing when their image is the most suitable. The browser will use the first <source> element with matching attribute values, and ignore any following <source> elements.
  • 21.
  • 23.
    Chapter Summary •Use theHTML <img> element to define an image •Use the HTML src attribute to define the URL of the image •Use the HTML alt attribute to define an alternate text for an image, if it cannot be displayed •Use the HTML width and height attributes to define the size of the image •Use the CSS width and height properties to define the size of the image (alternatively) •Use the CSS float property to let the image float •Use the HTML <map> element to define an image-map •Use the HTML <area> element to define the clickable areas in the image-map •Use the HTML <img>'s element usemap attribute to point to an image-map •Use the HTML <picture> element to show different images for different devices
  • 24.