05. CSS Box Model πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

Folder Structure

05-Stu-css-box-model
β”œβ”€β”€ assets
β”‚      β”œβ”€β”€css
β”‚      β”‚   └── style.css
β”‚      └── images
β”‚          β”œβ”€β”€ image-1.png
β”‚          β”œβ”€β”€ image-2.png
β”‚          β”œβ”€β”€ image-3.png
β”‚          └── image-4.png
└── index.html

Box Model

Work with a partner to implement the following user story:

  • As a developer, I want to use the CSS box model properties to position four boxes inside a frame.

Instructions

  • Correct the code so that each box has a defined:
    • padding property
    • margin property
    • border property

Your solution should match the following image:

Four numbered, differently colored boxes appear evenly spaced inside a larger box.

πŸ“ Notes

Refer to the documentation:

MDN Web Docs on CSS basic box model

MDN Web Docs on padding

MDN Web Docs on margin

MDN Web Docs on border

πŸ’‘ Hints

How can we use the margin property to define space between elements?

πŸ† Bonus

If you have completed this activity, work through the following challenge with your partner to further your knowledge:

  • What is the CSS float property?

Use Google or another search engine to research this.


βœ… Solutions

Solutions Click Here