CSS Units Explained: px, em, rem, %, vh and vw
Learn the most useful CSS units with simple examples, including px, em, rem, percent, vh, vw and dvh, and which unit I use for fonts, spacing and layout.
Bishal Biswas
Articles
Learn the most useful CSS units with simple examples, including px, em, rem, percent, vh, vw and dvh, and which unit I use for fonts, spacing and layout.
Bishal BiswasLearn the CSS box model with simple examples. Understand content, padding, border and margin, box-sizing border-box, and how margin collapsing works.
Learn what HTML entities are, why characters like < and & need escaping, and how to use named and numeric entities, nbsp, and UTF-8 in your pages.
Learn the difference between block and inline elements in HTML, how each one behaves in a layout, and how inline-block and CSS display change them.
Learn HTML accessibility basics with simple examples, including semantic elements, alt text, labels, keyboard focus, and when to use ARIA attributes.
Learn how to validate HTML forms without JavaScript using required, minlength, pattern, min, max and input types, plus CSS to style valid and invalid fields.
Learn the most useful HTML input types, from text, email and password to number, date, range, checkbox, radio, color and file, with simple examples.
Learn how the HTML iframe element works, how to embed videos and maps, make iframes responsive, and use sandbox, allow and lazy loading safely.
Learn how to add audio and video to a web page with HTML, including controls, autoplay rules, multiple sources, captions with track and poster images.
Learn the HTML meta tags that matter in 2026, including charset, viewport, description, robots, canonical, Open Graph and theme-color, with examples.