05-Stu-css-box-model
βββ assets
β βββcss
β β βββ style.css
β βββ images
β βββ image-1.png
β βββ image-2.png
β βββ image-3.png
β βββ image-4.png
βββ index.html
Work with a partner to implement the following user story:
padding
propertymargin
propertyborder
propertyYour solution should match the following image:
Refer to the documentation:
MDN Web Docs on CSS basic box model
How can we use the margin
property to define space between elements?
If you have completed this activity, work through the following challenge with your partner to further your knowledge:
float
property?Use Google or another search engine to research this.
section {
width: 600px;
height: 600px;
text-align: center;
border: 15px solid black;
}
img {
width: 200px;
height: 200px;
background-color: lightblue;
/* Margin property */
margin: 20px;
/* Padding property */
padding: 20px;
/* Border property */
border: 9px solid darkblue;
}
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="UTF-8">
<title>HTML Box Model</title>
<link rel="stylesheet" type="text/css" href="./assets/css/style.css">
</head>
<body>
<section>
<img src="./assets/images/image-1.png" alt="box with number 1"/>
<img src="./assets/images/image-2.png" alt="box with number 2"/>
<img src="./assets/images/image-3.png" alt="box with number 3"/>
<img src="./assets/images/image-4.png" alt="box with number 4"/>
</section>
</body>
</html>