🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to CSS Notes
Topic #105

CSS Units


CSS Units

CSS units are used to define the length and size of several properties.

Several CSS properties take "length" values, such as font-size, width, margin, padding, border, etc.

CSS has two types of units:

  • Absolute units
  • Relative units

CSS Absolute Units

Absolute units are fixed, and the length expressed in any of these will appear exactly that size.

Absolute units do NOT change when the screen size change, and are not recommended for websites. However, they can be used if the output medium is known, such as for print layout.

The most used absolute unit is px (pixels).


CSS Relative Units

Relative units specify a length relative to another length property (like parent element, root element, or viewport).

Relative length units scale better between different screen sizes, making them ideal for responsive web design.

The two most used relative units are em and rem.

Tip: The em and rem units are perfect for creating scalable and responsive websites!

Want to go beyond the notes?

Join CodingNow 2.0's CSS course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

CSS Units – FAQs

Quick answers about learning CSS Units in CSS.

This free note from CodingNow 2.0 explains CSS Units in CSS — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every CSS topic on CodingNow 2.0, including CSS Units, is 100% free with no signup required.
With focused practice, most students grasp CSS Units in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now