<picture>
<source
id="el"
srcset="medium-pic.jpg"
type="image/jpeg"
sizes="(50em <= width <= 60px) 50em,
(30em <= width < 50em) 30em" />
</picture>HTMLSourceElement: sizes property / notebook
HTMLSourceElement: sizes property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const el = document.getElementById("el");
console.log(el.sizes); // Output: "(50em <= width <= 60px) 50em, (30em <= width < 50em) 30em"
el.sizes = "(50em <= width <= 60px) 100em, (30em <= width < 50em) 60em"; // Updates the sizes value