SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)Introduction to Cascading Style Sheets (CSS)
Introduction to Cascading Style Sheets (CSS)
 
Html frames
Html framesHtml frames
Html frames
 
Bootstrap
BootstrapBootstrap
Bootstrap
 
Css box-model
Css box-modelCss box-model
Css box-model
 
Css Ppt
Css PptCss Ppt
Css Ppt
 
Html5 tutorial for beginners
Html5 tutorial for beginnersHtml5 tutorial for beginners
Html5 tutorial for beginners
 
cascading style sheet ppt
cascading style sheet pptcascading style sheet ppt
cascading style sheet ppt
 
HTML
HTMLHTML
HTML
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
css.ppt
css.pptcss.ppt
css.ppt
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
 
Introduction to html
Introduction to htmlIntroduction to html
Introduction to html
 
Basic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdfBasic Details of HTML and CSS.pdf
Basic Details of HTML and CSS.pdf
 
CSS for Beginners
CSS for BeginnersCSS for Beginners
CSS for Beginners
 
Presentation on HTML
Presentation on HTMLPresentation on HTML
Presentation on HTML
 
Presentation of bootstrap
Presentation of bootstrapPresentation of bootstrap
Presentation of bootstrap
 
Anchor tag HTML Presentation
Anchor tag HTML PresentationAnchor tag HTML Presentation
Anchor tag HTML Presentation
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
Css Text Formatting
Css Text FormattingCss Text Formatting
Css Text Formatting
 
CSS ppt
CSS pptCSS ppt
CSS ppt
 

Similar to Html images syntax

Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)Nuzhat Memon
 
HTML5 - Insert images and Apply page backgrounds
HTML5 - Insert images and Apply page backgroundsHTML5 - Insert images and Apply page backgrounds
HTML5 - Insert images and Apply page backgroundsGrayzon Gonzales, LPT
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding imagesBulldogs83
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgroundsnobel mujuji
 
Html 5 and CSS - Image Element
Html 5 and CSS - Image ElementHtml 5 and CSS - Image Element
Html 5 and CSS - Image ElementKempy7000
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)ghayour abbas
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptxSteins18
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptxssdd60
 
Working with Images
Working with ImagesWorking with Images
Working with ImagesNicole Ryan
 
HTML Link - Image - Comments
HTML  Link - Image - CommentsHTML  Link - Image - Comments
HTML Link - Image - CommentsHameda Hurmat
 

Similar to Html images syntax (20)

Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
 
HTML Images
HTML Images HTML Images
HTML Images
 
HTML5 - Insert images and Apply page backgrounds
HTML5 - Insert images and Apply page backgroundsHTML5 - Insert images and Apply page backgrounds
HTML5 - Insert images and Apply page backgrounds
 
2.1 adding images
2.1 adding images2.1 adding images
2.1 adding images
 
Imagetag
ImagetagImagetag
Imagetag
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgrounds
 
Html 5 and CSS - Image Element
Html 5 and CSS - Image ElementHtml 5 and CSS - Image Element
Html 5 and CSS - Image Element
 
Html 5
Html   5Html   5
Html 5
 
Web Development 3 (HTML & CSS)
Web Development 3  (HTML & CSS)Web Development 3  (HTML & CSS)
Web Development 3 (HTML & CSS)
 
Images
ImagesImages
Images
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptx
 
HTML_Images.ppt
HTML_Images.pptHTML_Images.ppt
HTML_Images.ppt
 
HTML Attributes.pptx
HTML Attributes.pptxHTML Attributes.pptx
HTML Attributes.pptx
 
CAP 756 UNIT 1.pptx
CAP 756 UNIT 1.pptxCAP 756 UNIT 1.pptx
CAP 756 UNIT 1.pptx
 
N5 Computing Science HTML
N5 Computing Science HTMLN5 Computing Science HTML
N5 Computing Science HTML
 
HTML (part ii).pptx
HTML (part ii).pptxHTML (part ii).pptx
HTML (part ii).pptx
 
Working with Images
Working with ImagesWorking with Images
Working with Images
 
Html images
Html imagesHtml images
Html images
 
HTML Link - Image - Comments
HTML  Link - Image - CommentsHTML  Link - Image - Comments
HTML Link - Image - Comments
 
Linking
LinkingLinking
Linking
 

More from JayjZens

Science 7 lesson 1.1
Science 7 lesson 1.1Science 7 lesson 1.1
Science 7 lesson 1.1JayjZens
 
Quilling famtime
Quilling famtimeQuilling famtime
Quilling famtimeJayjZens
 
Rebekah women of the bible
Rebekah women of the bibleRebekah women of the bible
Rebekah women of the bibleJayjZens
 
1. intro ict
1. intro ict1. intro ict
1. intro ictJayjZens
 
Evaluating internet resources
Evaluating internet resourcesEvaluating internet resources
Evaluating internet resourcesJayjZens
 
Web browser &amp; search engine
Web browser &amp; search engineWeb browser &amp; search engine
Web browser &amp; search engineJayjZens
 
Introbotics
IntroboticsIntrobotics
IntroboticsJayjZens
 
Creating &amp; organizing bookmark for website
Creating &amp; organizing bookmark for websiteCreating &amp; organizing bookmark for website
Creating &amp; organizing bookmark for websiteJayjZens
 
Advantages and disadvantages of using online tools
Advantages and disadvantages of using online toolsAdvantages and disadvantages of using online tools
Advantages and disadvantages of using online toolsJayjZens
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5JayjZens
 
Styling of css
Styling of cssStyling of css
Styling of cssJayjZens
 
Html table
Html tableHtml table
Html tableJayjZens
 
Html links
Html linksHtml links
Html linksJayjZens
 
Creating you first web page!
Creating you first web page!Creating you first web page!
Creating you first web page!JayjZens
 
Roborobo 3 parts
Roborobo  3 partsRoborobo  3 parts
Roborobo 3 partsJayjZens
 
Roborobo 3 p arts definition
Roborobo  3 p arts definitionRoborobo  3 p arts definition
Roborobo 3 p arts definitionJayjZens
 
Liquidity ratio
Liquidity ratioLiquidity ratio
Liquidity ratioJayjZens
 
Corals and coral reefs
Corals and coral reefsCorals and coral reefs
Corals and coral reefsJayjZens
 

More from JayjZens (18)

Science 7 lesson 1.1
Science 7 lesson 1.1Science 7 lesson 1.1
Science 7 lesson 1.1
 
Quilling famtime
Quilling famtimeQuilling famtime
Quilling famtime
 
Rebekah women of the bible
Rebekah women of the bibleRebekah women of the bible
Rebekah women of the bible
 
1. intro ict
1. intro ict1. intro ict
1. intro ict
 
Evaluating internet resources
Evaluating internet resourcesEvaluating internet resources
Evaluating internet resources
 
Web browser &amp; search engine
Web browser &amp; search engineWeb browser &amp; search engine
Web browser &amp; search engine
 
Introbotics
IntroboticsIntrobotics
Introbotics
 
Creating &amp; organizing bookmark for website
Creating &amp; organizing bookmark for websiteCreating &amp; organizing bookmark for website
Creating &amp; organizing bookmark for website
 
Advantages and disadvantages of using online tools
Advantages and disadvantages of using online toolsAdvantages and disadvantages of using online tools
Advantages and disadvantages of using online tools
 
1. introduction to html5
1. introduction to html51. introduction to html5
1. introduction to html5
 
Styling of css
Styling of cssStyling of css
Styling of css
 
Html table
Html tableHtml table
Html table
 
Html links
Html linksHtml links
Html links
 
Creating you first web page!
Creating you first web page!Creating you first web page!
Creating you first web page!
 
Roborobo 3 parts
Roborobo  3 partsRoborobo  3 parts
Roborobo 3 parts
 
Roborobo 3 p arts definition
Roborobo  3 p arts definitionRoborobo  3 p arts definition
Roborobo 3 p arts definition
 
Liquidity ratio
Liquidity ratioLiquidity ratio
Liquidity ratio
 
Corals and coral reefs
Corals and coral reefsCorals and coral reefs
Corals and coral reefs
 

Recently uploaded

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageGlobus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILNatan Silnitsky
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxwottaspaceseo
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Globus
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 

Recently uploaded (20)

Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 

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 Attribute If a browser cannot find an image, it will display the value of the alt attribute:
  • 5. The alt Attribute If 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 can use 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 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:
  • 12. 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:
  • 13. Animated Images HTML allows animated GIFs:
  • 14. Image as a Link To use an image as a link, put the <img> tag inside the <a> tag:
  • 15. Image Floating Use the CSS float property to let the image float to the right or to the left of a text:
  • 16. Image Floating Use the CSS 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.
  • 19. Background Image To add a 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.
  • 22.
  • 23. 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