CSS
Width And Height
Sizing ItemsCSS Classroom: Width and Height
Margin and padding gave us control over the space around and inside an element. Now it’s time to control the actual size of the element itself. CSS gives us properties like width, height, max-width, and min-height to shape our boxes.
Width and Height Basics
The width property sets how wide an element is. The height property sets how tall an element is. By default, elements expand to fit their content or their parent container, but with these properties you can give them exact sizes.
Members only
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 12 more lessons in CSS.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.