C040 Box Model
Create a new index.html with the following content:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</body>
</html>
Now add a style.css file and ensure the following:
- All
divs should have a height and width of100px. - All
divs should have a margin of20px. - All
divs should have a padding of20px. - All
divs should have a border of1px solid black. - All
divs should have a yellow background color: - Except for the second
div, which should have a pink background color. - The third
divshould not be visible: - Experiment with both
visibility: hiddenanddisplay: noneto see the difference.
It should look something like this:
See a possible solution
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<link rel="stylesheet" href="style.css" />
<title>Document</title>
</head>
<body>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</body>
</html>
