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>Backgrounds and borders</title>
<style>
body {
background-color: #fff;
color: #333;
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 1em;
margin: 0;
}
* {
box-sizing: border-box;
}
.box {
width: 500px;
padding: 0.5em;
border: 5px solid black;
border-radius: 10px;
background-image: url(images/balloons.jpg);
background-size: cover;
}
h2 {
background-color: rgba(0, 0, 0, .5);
color: white;
}
</style>
</head>
<body>
<div class="box">
<h2>Backgrounds & Borders</h2>
</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>Background image test</title>
<style>
body {
background-color: #fff;
color: #333;
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
padding: 1em;
margin: 0;
}
* {
box-sizing: border-box;
}
.box {
width: 300px;
padding: 0.5em;
border: 5px solid lightblue;
border-top-left-radius: 20px;
border-bottom-right-radius: 40px;
}
h2 {
padding: 0 40px;
text-align: center;
background: url(images/star.png) no-repeat left center,
url(images/star.png) repeat-y right center;
}
</style>
</style>
</head>
<body>
<div class="box">
<h2>Backgrounds & Borders</h2>
</div>
</body>
</html>
도움 받은 곳
Task 1: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/rgba
Task 1, 2 : https://github.com/mdn/css-examples/blob/main/learn/tasks/backgrounds/marking.md#task-2
'CSS > MDN 문제 풀이' 카테고리의 다른 글
Test your skills: Overflow (0) | 2022.11.07 |
---|---|
Test your skills: Writing modes and logical properties (0) | 2022.11.07 |
Test your skills: The box model (0) | 2022.11.06 |
Test your skills: Selectors (0) | 2022.11.06 |
Test your skills: The Cascade (0) | 2022.11.04 |