CSS Tips — Practical img Element Defaults

VideoZoran Jambor

A line-by-line guide through the sensible CSS for image elements.

A line-by-line guide through the sensible CSS for image elements you should apply in all your projects to make your img elements bulletproof by default.

All credit goes to Harry Roberts, who originally shared this technique on Twitter.

Chapters

  • 00:00 Why you should use this technique
  • 00:49 Demo setup
  • 01:12 Fix distorted images
  • 02:14 Fix empty space under images
  • 03:02 Style alt text
  • 03:59 Style low-quality image placeholders (LQIP)
  • 05:07 Add margin for shape-outside

Demo

Links

CSS Stickers

CSS Stickers

A set of beautiful, cute, and funny CSS stickers to showcase your love for CSS.

Get Your Set Today »
CSS Weekly YouTube Channel

CSS Weekly YouTube Channel

Weekly hands-on tutorials, tips, tools, news, and more — everything related to CSS and front-end development, created by Zoran Jambor.

Subscribe Today »