display: flex
display: grid
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.
<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.
<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.
<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.
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).
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
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.
<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. Thesizes
attribute allows you to specify a list of media conditions and corresponding image sizes
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.