Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/evavic44/picture-element

A tutorial for explaining how to use the html picture element
https://github.com/evavic44/picture-element

css html html5 media-queries picture picture-element picture-tag tutorial tutorial-code

Last synced: about 2 months ago
JSON representation

A tutorial for explaining how to use the html picture element

Awesome Lists containing this project

README

        

HTML Picture Element

[![Netlify Status](https://api.netlify.com/api/v1/badges/3f059b5f-657b-42a0-b835-b717355d5a58/deploy-status)](https://app.netlify.com/sites/picture-element/deploys)

The picture element is an HTML element for declaring images based on different screen sizes or viewport without the need of writing CSS media queries. It takes in two properties, the —`` tag which makes use of the `srcset` property to specify different images based on different screen sizes and a compulsory `` tag that acts as a fallback image in case the browser doesn't support the picture element.

There are a few use-case scenarios in which the picture tag can be very useful, below are three examples of these cases.

- Image type support
- Image width
- Saving Bandwidth

```html



Banner image

```

## Browser Compatibility

![picture-tag-support.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1653076517086/7XbrEluqY.png)

Source: [MDN Docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture)