Using Absolute Units in CSS
📖 Scenario: You are creating a simple webpage with a heading and a paragraph. You want to use absolute units in CSS to set the font sizes and spacing so that they stay consistent regardless of screen size.
🎯 Goal: Build a webpage with a heading and a paragraph. Use absolute CSS units cm and in to set the font size of the heading and the margin of the paragraph.
📋 What You'll Learn
Create an HTML skeleton with a
<h1> heading and a <p> paragraph.Use CSS to set the heading font size to
2cm.Use CSS to set the paragraph margin to
1in on all sides.Ensure the CSS is included inside a
<style> tag in the HTML <head>.Use semantic HTML and include
lang and charset meta tags.💡 Why This Matters
🌍 Real World
Absolute units are useful when you want precise physical measurements on printed pages or fixed-size displays.
💼 Career
Web developers often need to control layout and typography precisely, especially for print styles or specialized devices.
Progress0 / 4 steps