Skip to content

Latest commit

 

History

History
70 lines (42 loc) · 4.62 KB

201-class11.md

File metadata and controls

70 lines (42 loc) · 4.62 KB

Class 201.11

Notes

  • display: flex
    • rows vs columns
    • parent tells children how to be displayed
  • display: grid
    • dictate both dimensions (rows and columns)

Readings

Q&A's

Video and Audio Content

  1. Explain how the ability to use video and audio on the web has evolved since the early 2000s.

In the early 2000s, video and audio on the web relied on proprietary plugins like Flash and Silverlight. These had security and accessibility issues. With the evolution of HTML5, the <video> and <audio> elements allow native embedding of media without plugins. Browser support for different codecs has also expanded over time.

  1. Describe the use of the src and controls attributes in the <video> element.

The src attribute in <video> specifies the path to the video file to embed. The controls attribute adds the browser's default video controls like play/pause, volume, etc.

  1. Why is it important to have fallback content inside the <video> element?

Fallback content inside <video> provides an alternative way to access the media for browsers that don't support the <video> element. This ensures all users can get to the content through a link or other element.

  1. Write a very short story where <audio> and <video> are characters.

(I asked an AI to help me with this): 1 was feeling lonely, wishing someone would press play so he could share his music. One day, he met <video> at a developer meetup. She was vibrant and lively, always talking about the latest frames she got to display.

At first, <audio> was intimidated by her. But when she smiled and asked to hear one of his tracks, he shyly started playing a melody. <video> loved it and asked him for a collaboration.

Together they made beautiful music videos, with <audio> providing the soundtrack and <video> adding the visuals. Finally <audio>'s songs could be heard, thanks to his new friend.

A Complete Guide To Grid

  1. How does Grid layout differ from Flex?

Grid layout is a two-dimensional layout system, meaning it can handle both columns and rows, unlike flexbox which is largely a one-dimensional system. You work with Grid Layout by applying CSS rules both to a parent element (which becomes the Grid Container) and to that element’s children (which become Grid Items).

  1. Grid container, grid item, and grid line are a few important terms to understand when using Grid. Please describe these terms in a few sentences.

A grid container is the parent element that holds the grid items. A grid item is any child element of the grid container. Grid lines are the horizontal and vertical lines that divide the grid and separate the columns and rows.

Responsive Images

  1. Besides making a site visually appealing across different screen sizes, why should developers make images responsive?

Developers should make images responsive to improve the site’s performance and reduce the amount of data used by the user’s device. Responsive images let's the browser to choose the most appropriate image source based on the device’s screen size, resolution, and other factors.

  1. Define the following <img> attributes srcset and sizes. Write an example of how they are used. srcset is an attribute of the element that allows you to specify a list of image sources along with their widths or pixel densities. The sizes attribute allows you to specify a list of media conditions and corresponding image sizes

srcset is an attribute of the element that allows you to specify a list of image sources along with their widths or pixel densities. The sizes attribute allows you to specify a list of media conditions and corresponding image sizes

  1. How is srcset more helpful for responsive images than CSS or JavaScript?

srcset is more helpful for responsive images than CSS or JavaScript because it allows the browser to make the decision about which image source to use, rather than relying on CSS or JavaScript to do so, resulting in faster page load times and better performance.

References

  • Google Bard and ChatGPT