【HTML】小白笔记

问:What are the four attributes we want to include on every img element?
答: src, alt, height, width

Src is short for source, and links to the file.
Alt provides an alternative text experience of the image.
Height and width let the browser know how much space the image needs before the file is fetched, improving performance.

问:What is the most effective way to use bandwidth efficiently when sending images?
答: Create a set of options the browser can choose from using the srcset attribute. The srcset attribute lets the browser choose from options that fit the specific situation, minimizing bandwidth consumption while producing attractive results.
问:If you want to create a compact image that can display in large sizes without pixelation, which should you choose?
答:SVG. Scalable Vector Graphics can scale to massive sizes and still look neat, like they were built for it.
问:What do you need to change to move from a resolution-based srcset to a width-based srcset?
答: Provide pixel measurements (w) instead of 1x, 2x, etc.
问:If you want to keep a caption with an image, which combination of elements lets you identify them as connected?
答: Surround the image with a figure element, and use the figcaption element inside of figure. 
is designed to contain a caption that will stay with your image.
问:How do you create an image that changes content depending on the surrounding layout?
答: Nest img, source, and srcset information inside of a picture element. The  element gives you the flexibility you need to change content as well as image size.

你可能感兴趣的:(HTML,html5)