WEB-DEVELOPMENT-FOUNDATION practice question 13 of 15

What are the two types of CSS units? Choose 2 answers.

Full set: 75 questions
Answer options
A: Static
B: Relative Correct answer
C: Absolute Correct answer
D: Standard
E: Local Metric
Correct Answer:
B. Relative; C. Absolute
Explanation

CSS length values are categorized into two types: absolute and relative. Absolute length units are fixed and are not affected by the size of the parent element or the viewport. They are most useful when the output medium's physical properties are known, such as for print layouts. Examples include pixels (px), points (pt), and centimeters (cm). Relative length units are specified in relation to another length property, making them flexible and scalable. Examples include em (relative to the font-size of the element), rem (relative to the root element's font-size), and % (relative to the parent element's size).

Why Incorrect

A. Static: 'Static' is the default value for the CSS position property, not a type of measurement unit.
D. Standard: This is not a formal classification for CSS units; both absolute and relative units are part of the CSS standard.
E. Local: This term is not used in the official CSS specification to categorize measurement units.
F. Metric: While some absolute units like cm and mm are metric, "Metric" is not a formal CSS unit category itself. ---

References

1. Mozilla Developer Network (MDN) Web Docs: The CSS data type page explicitly states, "There are two types of length units: absolute and relative." It then details the units within each category.

Source: MDN Web Docs, - CSS: Cascading Style Sheets. See the introductory paragraph in the "Values" section.

2. W3C (World Wide Web Consortium) CSS Values and Units Module Level 4: The official specification for CSS units defines these two categories in separate sections.

Source: W3C Candidate Recommendation, 29 September 2022, "CSS Values and Units Module Level 4," Sections 6.1 ("Relative Lengths") and 6.2 ("Absolute Lengths").

3. MIT OpenCourseWare: Course materials for web development and user interface design cover these fundamental CSS concepts.

Source: MIT OCW, "6.170 Software Studio," Fall 2012. Lecture 10 notes on CSS, section on "Units." (This course and similar ones like 6.813 consistently teach this fundamental absolute/relative distinction).

Scroll to Top