1.5 Responsive Images Flashcards
Why do images need to be responsive?
There are different screen sizes, different resolutions, different pixel densities that need the right quality image to appear on the screen.
What are the 3 reasons why is it helpful to treat images as content?
SEO, accessibility and RSS feeds
Should images be placed in HTML, CSS, or JavaScript?
HTML
When should images be placed in CSS?
When it’s a repeat pattern or for presentation purposes
Why shouldn’t you use JavaScript for images?
It’s more error prone than HTML and CSS. And it doesn’t work well with parser for content purposes.
What are the primary advantages of using HTML elements and attributes for responsive images instead of CSS background images?
Many images are content, not just for decoration. Including content images in the HTML markup is better for SEO, accessibility, and general separation between structure and presentation
What type of image is best delivered in JPEG format?
Photographs
Why can 2x photographs have a higher amount of JPEG compression?
When 2x images are resized in the layout, the scale of the JPEG artifacts tends to be reduced.
What types of images work best as SVGs?
When the image has lots of flat areas of solid colors.
In general, what’s wrong with sending a single high resolution image to every device?
Often a single high resolution image results in wasted bandwidth, particularly on 1x devices and smaller mobile screens.
What is the disadvantages of GIFs and PNGs?
GIF + PINGs tend to low slower because of file size.
WHat’s the advantage of SVGs?
SVGs are one of the best options, as it works at all pixel densities
What is image resolution?
It’s an image quality factor ranging from low DPI to high DPI. The right DPI depends on whether it’s going to be printed or how it is used online.
What is a polyfill?
A polyfill is a piece of JavaScript that will implement specific features in browsers that don’t support those features natively.
When using a polyfill, what happens to browsers that have native support for the polyfilled feature?
Browsers that support HTML natively will work as intended, and browsers that don’t– will use the polyfill.
How does the srcset attribute differ from the src attribute?
The srcset attribute allows us to specify multiple files for a single image.
When using the srcset attribute, it’s up to browser vendors to make the most intelligent choice about which file to deliver. Why might this be desirable behavior when we could instead maintain full control over image source selection using the picture element?
If browser vendors come up with a better way to choose sources or new devices come along, this implementation will leave the hard thinking out of our code and in the hands of the browser.
What is picturefill?
Picturefill enables support for the picture element and associated features in browsers that do not yet support them, so you can start using them today.
Can an Asynchronous attribute have dependencies?
No It must not have any dependencies because it can be loaded at any time.
How do you begin adding JS to the HTML file?
script src =
How do you add JS to HTML for picturefill?
script src = then
“url” async
How do you end JS snippet to the HTML file?
script src url async
Closing script tag
Is srcset currently supported by browsers?
Yes, srcset is supported by most browsers.
With the exception of IE which does not accept srcset
What two attributes can be specified when creating srcset?
Width
Pixel density descriptor
What does the pixel density descriptor do?
It refers to the image quality, number of pixels available.
It’s represented by using a number + x (ex: 1x, 2x, 3x)