👋 Developers! ❤️ Save for Later!
As frontend developers, we need to cater to users on different devices and screen sizes.
Take a look at this example of a website on a computer and a mobile phone. How would you implement it such that the image resolution is not compromised?
The HTML image element includes the srcset attribute, which specifies a set of image resources and their respective sizes for the browser to choose from.
The browser then selects the most appropriate image based on the user's device and display capabilities.
In this example, the browser can choose between 2 versions of the same image, each designed for different pixel densities.
If you want to display different pictures for different screen sizes, you can use the HTML picture element. It takes in one or more source tags and the browser will look for the first one where the media query matches the current viewport width.
The image element is required as the last child of the picture element, as a fallback option if none of the source tags matches.
This is the 1 minute sharing for today. Please give us a like, and share it with your friends!
#TinyFrontend #WebDevelopment #frontend #frontenddeveloper #frontenddev #frontenddevelopment #frontendwebdeveloper #frontendengineer #frontendengineering #frontendmasters #html #CSS
Смотрите видео #Responsive онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Tiny Frontend - 1 Minute Video Sharing 07 Декабрь 2023, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 182 раз и оно понравилось 9 людям.