SlideShare a Scribd company logo
Inserting and Working
with Images
Objectives
Evaluate image file types
Insert images
Insert a background image
Mark images as figures
Create a figure caption
Use images as links
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 2
Objectives (continued)
Create an image map
Define additional hotspots
Add a favicon and touch icons
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 3
Evaluate Image File Types
Images can be added to a web page
by linking to a separate file
Different image file types:
 Bitmap image: represented as a grid of
dots of specified colors
• e.g., JPG, GIF, and PNG
 Vector graphic: encoded as geometric
shapes
• e.g., SVG
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 4
Evaluate Image File Types
(continued)
Common file formats:
 JPG: optimized for many colors
• photographs
 GIF: optimized for areas with defined
borders, few colors
• Line drawings
• Supports transparent pixels
 PNG: allows user to specify opacity level
for areas
 SVG: no decrease in quality when scaled
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 5
Evaluate Image File Types
(continued)
Bitmap should be created and
formatted with its use on web in mind
 Created and displayed at set resolution
and size
Resolution: how close dots should be
in the output
 Measured in dots per inch (dpi)
 High resolution = more detail, large file
size
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 6
Evaluate Image File Types
(continued)
Size: length and width of image
 Pixels: individual dots that make up the
image
 Bitmaps display optimally at native size
 Scaling affects download time and image
quality
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 7
Insert Images
img element: used to add an image to
HTML document
 One-sided element
 Includes two attributes:
•src: path and filename to the image file
•alt: text to display if image is unavailable
 Inline element by default
• Can be wrapped in block element for
alignment purposes
• Can be within text, aligned to text baseline
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 8
Insert Images (continued)
Width and height attributes:
 Not required
 Can be used to specify the native
dimensions of an image
• Allow a visual user agent to maintain blank
space preserving the layout of the web page
 Always in pixels, no need to specify units
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 9
Insert Images (continued)
img elements and display
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 10
Insert a Background
Image
Image can be background of web
page or element
 Specify path and filename as value for
background property
 Important to maintain contrast between
background and text
 Specify background color in case image
not available or not supported
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 11
Insert a Background
Image (continued)
Tiling: displaying images repeatedly
 Used by user agents to fill screen space
Examples of syntax of background
property:
 background: url(“url goes here”)
 background-color
When property-value pairs conflict, the
one that occurs later in the rule takes
precedence
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 12
Insert a Background
Image (continued)
Code for background color and
image
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 13
Mark Images as Figures
figure element: used to mark images
that add information to a web page
 Semantic element
 Enables user agent to link figure element
contents to another location without
affecting information conveyed
Mark as a figure if the page would be
complete even if the figure is not
shown
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 14
Mark Images as Figures
(continued)
Code for fig and img elements
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 15
Create a Figure Caption
A figure caption provides context,
explantion, or credit.
A figure caption is different than alt
text.
 alt text should describe an image
without adding additional information
 Figure caption text can add information
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 16
Create a Figure Caption
(continued)
Use the figcaption element nested
in a figure element as shown below
title attribute specifies additional
image information
 Browsers display as floating text during
mouse over or alt text when not
specified
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 17
Use Images as Links
Images can be used as links
 Enclose img element within an a
element
Browsers typically add border around
linked image to display link state
 Use pseudo-classes to modify link state
colors
 Use CSS border property to remove the
border
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 18
Use Images as Links
(continued)
Examples of code for creating an img
element as a link
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 19
Create an Image Map
An image map is HTML code
associated with an image that
specifies one or more shapes using
sets of coordinates and provides a link
target for each shape
Each linked shape is known as a
hotspot
Shape values can be rect, poly, or
circle
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 20
Create an Image Map
(continued)
Coordinates are measured from the
top-left corner
Use third-party software to generate
the coordinates
Code for rect shape in an image
map
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 21
Define Additional Hotspots
rect coordinates based on top-left
corner and bottom-right corner of
shape
poly coordinates based on each
vertices in the shape
circle coordinates based on center
point and radius of the circle
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 22
Define Additional Hotspots
(continued)
Code for hotspots and resulting image
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 23
Insert a Favicon and Touch Icons
Favicon: icon associated with web
page in the address bar and on
bookmarks
 16 x 16 pixels
 Saved in .ico format
To specify for all pages of website,
place in root folder for the site
To specify for individual page use link
element
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 24
Insert a Favicon and Touch Icons
(continued)
Touch icon: displayed on users screen
when user creates a shortcut on a
mobile device
Characteristics of favicons and touch
icons shown below
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 25
Insert a Favicon and Touch Icons
(continued)
Code for favicon and resulting page
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 26
Insert a Favicon and Touch Icons
(continued)
Code and examples of touch icons
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 27
Summary
Bitmap images: represented as grid of
dots of specified colors
Vector graphic: encoded as geometric
shapes
Quality of image is determined by
resolution and size
Image types include JPEG, PNG, GIF,
and SVG
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 28
Summary (continued)
Use one sided img element to insert
image
 Uses src and alt attributes
background element used to insert a
background image, which browsers
tile by default
figure element: used to mark
images that add information to web
page
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 29
Summary (continued)
figcaption element can be used to
include figure caption, figcaption
element is nested within a figure
element
title attribute can also be used to
provide additional information about
an image
Images can be used as links when
enclosed in an a element
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 30
Summary (continued)
Image maps can be used to link
shapes (called hotspots) in an image
to different targets
Favicon is an icon associated with
web page and is displayed in the
address bar
Touch icons displayed when a user
saves a shortcut to a mobile device
HTML 5 and CSS 3, Illustrated, 2nd
Ed. 31

More Related Content

PPTX
Html ppt
PPTX
SQL Queries Information
PPTX
Spreadsheet advanced functions ppt (2)
PPT
Google Sites
PPT
Css Ppt
PPTX
Html images
DOCX
Lab manual asp.net
PPTX
HTML Lesson 1
Html ppt
SQL Queries Information
Spreadsheet advanced functions ppt (2)
Google Sites
Css Ppt
Html images
Lab manual asp.net
HTML Lesson 1

What's hot (20)

PPT
Training On Microsoft Excel
PPT
Lecture 1 intro to web designing
PDF
Intro to HTML and CSS basics
PPTX
6 types of web application development
PPTX
All ms word 2013
PPTX
Crystal report
PPTX
Html coding
PDF
Lecture-3: Introduction to html - Basic Structure & Block Building
PPT
Introduction to CSS
PPTX
Image contro, and format functions in vb
PPTX
File Uploading in PHP
PPTX
Conditional formatting
PDF
Apuntes de XSD
PPTX
SQL Joins.pptx
PPT
Introduction to Photoshop
PDF
Oracle SQL Basics
PDF
Introduction to Web Design
PPTX
Grade 5 Computer
PPTX
Excel training
PPTX
Excel 2010
Training On Microsoft Excel
Lecture 1 intro to web designing
Intro to HTML and CSS basics
6 types of web application development
All ms word 2013
Crystal report
Html coding
Lecture-3: Introduction to html - Basic Structure & Block Building
Introduction to CSS
Image contro, and format functions in vb
File Uploading in PHP
Conditional formatting
Apuntes de XSD
SQL Joins.pptx
Introduction to Photoshop
Oracle SQL Basics
Introduction to Web Design
Grade 5 Computer
Excel training
Excel 2010
Ad

Viewers also liked (6)

PPT
Organizing Content with Lists and Tables
PPT
Javascript programming using the document object model
PPT
Creating Visual Effects and Animation
PPT
Working with Video and Audio
PPT
Creating and Processing Web Forms
PPT
Structure Web Content
Organizing Content with Lists and Tables
Javascript programming using the document object model
Creating Visual Effects and Animation
Working with Video and Audio
Creating and Processing Web Forms
Structure Web Content
Ad

Similar to Working with Images (20)

PPT
Formatting text with CSS
PPTX
HTML & CSS: Chapter 03
PPTX
HTML5 - Insert images and Apply page backgrounds
PPTX
Html images syntax
PPT
Dreamweaver Ch03
PPTX
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
PPTX
CAP 756 UNIT 1.pptx
PDF
Chapter 2 - HTML5.pdf
PPT
Developing a Web Page
PPTX
About graphics-on-web
DOCX
Web(chap2)
PPTX
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
PPT
Chase.com Content Management Presentation
DOCX
Html viva questions
PPTX
New Features of HTML 5.1 to Create More Flexible Web Experiences
PPTX
PPT
Laying Out Elements with CSS
PPTX
Std 10 Computer Chapter 3 Handling Images in HTML (Part 2)
PPTX
MTA html5 text_graphics_media
PPTX
Creating Links
Formatting text with CSS
HTML & CSS: Chapter 03
HTML5 - Insert images and Apply page backgrounds
Html images syntax
Dreamweaver Ch03
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
CAP 756 UNIT 1.pptx
Chapter 2 - HTML5.pdf
Developing a Web Page
About graphics-on-web
Web(chap2)
Std 10 Computer Chapter 3 Handling Images in HTML (Part 1)
Chase.com Content Management Presentation
Html viva questions
New Features of HTML 5.1 to Create More Flexible Web Experiences
Laying Out Elements with CSS
Std 10 Computer Chapter 3 Handling Images in HTML (Part 2)
MTA html5 text_graphics_media
Creating Links

More from Nicole Ryan (20)

PPT
Testing and Improving Performance
PPT
Optimizing a website for search engines
PPT
Inheritance
PPT
Python Dictionaries and Sets
PPT
Social media and your website
PPT
Working with Links
PPT
Getting Started with CSS
PPT
Getting Started with your Website
PPTX
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
PPTX
Chapter 11: Object Oriented Programming Part 2
PPTX
Intro to Programming: Modularity
PPT
Programming Logic and Design: Arrays
PPTX
Programming Logic and Design: Working with Data
PPT
Setting up your development environment
PPTX
Dynamic vs static
PPT
Working with Databases and MySQL
PPT
Using arrays with PHP for forms and storing information
PPTX
Tables and forms accessibility and microformats
PPTX
Creating and styling forms
PPTX
Creating and styling tables
Testing and Improving Performance
Optimizing a website for search engines
Inheritance
Python Dictionaries and Sets
Social media and your website
Working with Links
Getting Started with CSS
Getting Started with your Website
Chapter 12 Lecture: GUI Programming, Multithreading, and Animation
Chapter 11: Object Oriented Programming Part 2
Intro to Programming: Modularity
Programming Logic and Design: Arrays
Programming Logic and Design: Working with Data
Setting up your development environment
Dynamic vs static
Working with Databases and MySQL
Using arrays with PHP for forms and storing information
Tables and forms accessibility and microformats
Creating and styling forms
Creating and styling tables

Recently uploaded (20)

PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PPTX
master seminar digital applications in india
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Updated Idioms and Phrasal Verbs in English subject
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Trump Administration's workforce development strategy
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
PDF
Computing-Curriculum for Schools in Ghana
PDF
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf
Orientation - ARALprogram of Deped to the Parents.pptx
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
master seminar digital applications in india
2.FourierTransform-ShortQuestionswithAnswers.pdf
History, Philosophy and sociology of education (1).pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
STATICS OF THE RIGID BODIES Hibbelers.pdf
Updated Idioms and Phrasal Verbs in English subject
Weekly quiz Compilation Jan -July 25.pdf
What if we spent less time fighting change, and more time building what’s rig...
Trump Administration's workforce development strategy
Final Presentation General Medicine 03-08-2024.pptx
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Chinmaya Tiranga quiz Grand Finale.pdf
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
UV-Visible spectroscopy..pptx UV-Visible Spectroscopy – Electronic Transition...
Computing-Curriculum for Schools in Ghana
RTP_AR_KS1_Tutor's Guide_English [FOR REPRODUCTION].pdf

Working with Images

  • 2. Objectives Evaluate image file types Insert images Insert a background image Mark images as figures Create a figure caption Use images as links HTML 5 and CSS 3, Illustrated, 2nd Ed. 2
  • 3. Objectives (continued) Create an image map Define additional hotspots Add a favicon and touch icons HTML 5 and CSS 3, Illustrated, 2nd Ed. 3
  • 4. Evaluate Image File Types Images can be added to a web page by linking to a separate file Different image file types:  Bitmap image: represented as a grid of dots of specified colors • e.g., JPG, GIF, and PNG  Vector graphic: encoded as geometric shapes • e.g., SVG HTML 5 and CSS 3, Illustrated, 2nd Ed. 4
  • 5. Evaluate Image File Types (continued) Common file formats:  JPG: optimized for many colors • photographs  GIF: optimized for areas with defined borders, few colors • Line drawings • Supports transparent pixels  PNG: allows user to specify opacity level for areas  SVG: no decrease in quality when scaled HTML 5 and CSS 3, Illustrated, 2nd Ed. 5
  • 6. Evaluate Image File Types (continued) Bitmap should be created and formatted with its use on web in mind  Created and displayed at set resolution and size Resolution: how close dots should be in the output  Measured in dots per inch (dpi)  High resolution = more detail, large file size HTML 5 and CSS 3, Illustrated, 2nd Ed. 6
  • 7. Evaluate Image File Types (continued) Size: length and width of image  Pixels: individual dots that make up the image  Bitmaps display optimally at native size  Scaling affects download time and image quality HTML 5 and CSS 3, Illustrated, 2nd Ed. 7
  • 8. Insert Images img element: used to add an image to HTML document  One-sided element  Includes two attributes: •src: path and filename to the image file •alt: text to display if image is unavailable  Inline element by default • Can be wrapped in block element for alignment purposes • Can be within text, aligned to text baseline HTML 5 and CSS 3, Illustrated, 2nd Ed. 8
  • 9. Insert Images (continued) Width and height attributes:  Not required  Can be used to specify the native dimensions of an image • Allow a visual user agent to maintain blank space preserving the layout of the web page  Always in pixels, no need to specify units HTML 5 and CSS 3, Illustrated, 2nd Ed. 9
  • 10. Insert Images (continued) img elements and display HTML 5 and CSS 3, Illustrated, 2nd Ed. 10
  • 11. Insert a Background Image Image can be background of web page or element  Specify path and filename as value for background property  Important to maintain contrast between background and text  Specify background color in case image not available or not supported HTML 5 and CSS 3, Illustrated, 2nd Ed. 11
  • 12. Insert a Background Image (continued) Tiling: displaying images repeatedly  Used by user agents to fill screen space Examples of syntax of background property:  background: url(“url goes here”)  background-color When property-value pairs conflict, the one that occurs later in the rule takes precedence HTML 5 and CSS 3, Illustrated, 2nd Ed. 12
  • 13. Insert a Background Image (continued) Code for background color and image HTML 5 and CSS 3, Illustrated, 2nd Ed. 13
  • 14. Mark Images as Figures figure element: used to mark images that add information to a web page  Semantic element  Enables user agent to link figure element contents to another location without affecting information conveyed Mark as a figure if the page would be complete even if the figure is not shown HTML 5 and CSS 3, Illustrated, 2nd Ed. 14
  • 15. Mark Images as Figures (continued) Code for fig and img elements HTML 5 and CSS 3, Illustrated, 2nd Ed. 15
  • 16. Create a Figure Caption A figure caption provides context, explantion, or credit. A figure caption is different than alt text.  alt text should describe an image without adding additional information  Figure caption text can add information HTML 5 and CSS 3, Illustrated, 2nd Ed. 16
  • 17. Create a Figure Caption (continued) Use the figcaption element nested in a figure element as shown below title attribute specifies additional image information  Browsers display as floating text during mouse over or alt text when not specified HTML 5 and CSS 3, Illustrated, 2nd Ed. 17
  • 18. Use Images as Links Images can be used as links  Enclose img element within an a element Browsers typically add border around linked image to display link state  Use pseudo-classes to modify link state colors  Use CSS border property to remove the border HTML 5 and CSS 3, Illustrated, 2nd Ed. 18
  • 19. Use Images as Links (continued) Examples of code for creating an img element as a link HTML 5 and CSS 3, Illustrated, 2nd Ed. 19
  • 20. Create an Image Map An image map is HTML code associated with an image that specifies one or more shapes using sets of coordinates and provides a link target for each shape Each linked shape is known as a hotspot Shape values can be rect, poly, or circle HTML 5 and CSS 3, Illustrated, 2nd Ed. 20
  • 21. Create an Image Map (continued) Coordinates are measured from the top-left corner Use third-party software to generate the coordinates Code for rect shape in an image map HTML 5 and CSS 3, Illustrated, 2nd Ed. 21
  • 22. Define Additional Hotspots rect coordinates based on top-left corner and bottom-right corner of shape poly coordinates based on each vertices in the shape circle coordinates based on center point and radius of the circle HTML 5 and CSS 3, Illustrated, 2nd Ed. 22
  • 23. Define Additional Hotspots (continued) Code for hotspots and resulting image HTML 5 and CSS 3, Illustrated, 2nd Ed. 23
  • 24. Insert a Favicon and Touch Icons Favicon: icon associated with web page in the address bar and on bookmarks  16 x 16 pixels  Saved in .ico format To specify for all pages of website, place in root folder for the site To specify for individual page use link element HTML 5 and CSS 3, Illustrated, 2nd Ed. 24
  • 25. Insert a Favicon and Touch Icons (continued) Touch icon: displayed on users screen when user creates a shortcut on a mobile device Characteristics of favicons and touch icons shown below HTML 5 and CSS 3, Illustrated, 2nd Ed. 25
  • 26. Insert a Favicon and Touch Icons (continued) Code for favicon and resulting page HTML 5 and CSS 3, Illustrated, 2nd Ed. 26
  • 27. Insert a Favicon and Touch Icons (continued) Code and examples of touch icons HTML 5 and CSS 3, Illustrated, 2nd Ed. 27
  • 28. Summary Bitmap images: represented as grid of dots of specified colors Vector graphic: encoded as geometric shapes Quality of image is determined by resolution and size Image types include JPEG, PNG, GIF, and SVG HTML 5 and CSS 3, Illustrated, 2nd Ed. 28
  • 29. Summary (continued) Use one sided img element to insert image  Uses src and alt attributes background element used to insert a background image, which browsers tile by default figure element: used to mark images that add information to web page HTML 5 and CSS 3, Illustrated, 2nd Ed. 29
  • 30. Summary (continued) figcaption element can be used to include figure caption, figcaption element is nested within a figure element title attribute can also be used to provide additional information about an image Images can be used as links when enclosed in an a element HTML 5 and CSS 3, Illustrated, 2nd Ed. 30
  • 31. Summary (continued) Image maps can be used to link shapes (called hotspots) in an image to different targets Favicon is an icon associated with web page and is displayed in the address bar Touch icons displayed when a user saves a shortcut to a mobile device HTML 5 and CSS 3, Illustrated, 2nd Ed. 31