Vadim Makeev, HTML Academy
Colors | Transparency | Animation | |
---|---|---|---|
GIF | 256 | Yes | Yes |
PNG | 256 or more | Yes, alpha | Yes, but no |
JPEG | A lot | No | No |
SVG | A lot | Yes | Yes |
WebP | 256 or more | Yes, alpha | Yes |
HEIC | A lot | Yes, alpha | Yes |
GIF is a genre,
not a format anymore.
<video autoplay loop muted>
<source type="video/webm" src="bolt.webm">
<source type="video/mp4" src="bolt.mp4">
</video>
$ ffmpeg -i bolt.gif -movflags faststart -pix_fmt yuv420p -crf 0 bolt.mp4
.burger {
position: relative;
width: 12px;
height: 10px;
}
.burger__line {
position: absolute;
left: 0;
width: 12px;
height: 2px;
background-color: #4b86c2;
}
.burger {
width: 12px; height: 10px;
background-image: repeating-linear-gradient(
#4b86c2, #4b86c2 2px,
#fff 2px, #fff 4px
);
}
<svg width="120" viewBox="0 0 12 10" fill="#4b86c2">
<rect width="12" height="2" x="0" y="0"/>
<rect width="12" height="2" x="0" y="4"/>
<rect width="12" height="2" x="0" y="8"/>
</svg>
div {
--burger-color: #4b86c2;
background-image: url('burger.png');
background-image: paint(burger);
}
CSS.paintWorklet.addModule('burger.js');
class Shape {
static get inputProperties() {
return ['--burger-color'];
}
paint(context, geometry, properties) { … }
}
registerPaint('burger', Shape);
const color = properties.get(
'--burger-color'
);
context.fillStyle = color;
context.fillRect(0, 0, 120, 20);
context.fillRect(0, 40, 120, 20);
context.fillRect(0, 80, 120, 20);
div:hover {
--burger-color: #32b332;
}
PNG | PNG 8 | JPG | SVG | |
---|---|---|---|---|
Photoshop | 852 | 155 | 3596 | 130 |
Affinity | 1555 | 856 | 10793 | 602 |
Sketch | 5639 | … | 3836 | 525 |
Figma | 2179 | … | 7797 | 153 |
Hands | 111 | 111 | 1144 | 98 |
<img src="cat.jpg" alt="Red cat">
button {
background-image: url(icon.png);
}
div.picture {
background-image: url(picture.png);
background-size: cover;
}
img, video {
object-fit: cover;
object-position: 25% 0;
}
Good interface
is like a progress bar.
button {
background-image: url('data:image/png;base64,iVBORw0K EUgAAAgAAAAIACAYAAAD0eNT6AAAACXBIWXMAAA7EAAAOxAGV AAgyAAAQJABAIAgAwAAQQYAAIIMAAAEGQAACDIAABBkAAAgyA MAAAEGQAACDIAABBkAAAgyAAAQJABAIAgAwAAQQYAAIIMAAAE ABBkAAAgyAAAQJABLJBGFFAIAgAwAAQQYAAIIMAAAEGQA…');
}
button {
background-image: url('data:image/svg+xml,%3Csvg xmlns ='http://www.w3.org/2000/svg' viewBox='0 0 12 10' fill='%234b86c2'%3E%3Crect width='12' height='2' x='0' y='0'/%3E%3Crect width='12' height='2' x='0' y='4'/%3E%3Crect width='12' height='2' x='0' y…');
}