Task 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 1</title>
<style>
body {
background-color: #fff;
color: #333;
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 1em;
margin: 0;
}
.box {
border: 5px solid #000;
width: 400px;
margin-bottom: 1em;
}
.box1 {
min-height: 100px;
}
.box2 {
height: 100px;
}
</style>
</head>
<body>
<div class="box box1">
<p>
Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd.
</p>
</div>
<div class="box box2">
<p>
Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd.
</p>
</div>
</body>
</html>
Task 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 2</title>
<style>
* {
box-sizing: border-box;
}
body {
background-color: #fff;
color: #333;
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 1em;
margin: 0;
}
.box {
border: 5px solid #000;
width: 400px;
margin-bottom: 1em;
}
.inner {
background-color: rebeccapurple;
color: white;
border-radius: 5px;
width: 60%;
padding: 10%;
}
</style>
</head>
<body>
<div class="box">
<div class="inner">Make me 60% of my parent's width.</div>
</div>
</body>
</html>
Task 3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task 3</title>
<style>
body {
background-color: #fff;
color: #333;
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 1em;
margin: 0;
}
.box {
border: 5px solid #000;
width: 400px;
margin-bottom: 1em;
}
img {
max-width: 100%;
}
</style>
</head>
<body>
<div class="box">
<img src="images/star.png" alt="star">
</div>
<div class="box">
<img src="images/balloons.jpg" alt="balloons">
</div>
</body>
</html>
도움 받은 곳
https://discourse.mozilla.org/t/test-your-skills-sizing/70151
https://github.com/mdn/css-examples/blob/main/learn/tasks/sizing/marking.md
깨달은 것
Task 2:
다른 컨테이너 안에 있는 상자의 경우, 자식 상자에 백분율 너비를 지정하면 부모 컨테이너 너비의 백분율이 됩니다.(MDN)
'CSS > MDN 문제 풀이' 카테고리의 다른 글
Test your skills: Tables (0) | 2022.11.09 |
---|---|
Test your skills: Images and form elements (0) | 2022.11.08 |
Test your skills: Values and units (0) | 2022.11.08 |
Test your skills: Overflow (0) | 2022.11.07 |
Test your skills: Writing modes and logical properties (0) | 2022.11.07 |