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)

 

 

 

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;
        }
        ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        li {
            margin: 1em;
            padding: 0.5em;
        }
        .hex {
            background-color: #86DEFA;
        }

        .rgb {
            background-color: rgb(134, 222, 250);
        }

        .hsl {
            background-color: hsl(194, 92%, 75%);
        }

        .transparency {
            background-color: rgba(134, 222, 250, .6);
        }
    </style>
</head>
<body>
    <ul>
        <li class="hex">hex color</li>
        <li class="rgb">RGB color</li>
        <li class="hsl">HSL color</li>
        <li class="transparency">Alpha value 0.6</li>
    </ul>
</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>
        body {
            background-color: #fff;
            color: #333;
            font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
            padding: 1em;
            margin: 0;
        }

        h1 {
            font-size: 50px;
        }

        h2 {
            font-size: 2em;
        }

        p {
            font-size: 16px;
        }

        h1 + p {
            font-size: 120%;
        }
    </style>
</head>
<body>
    <h1>Level 1 heading</h1>
    <p>
        Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon
        azuki bean garlic.
    </p>
    <h2>Level 2 heading</h2>
    <p>
        Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens
        dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.
    </p>    
</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;
            height: 200px;
            background-image: url("images/star.png");
            background-repeat: no-repeat;
            background-position: center 20%;
        }
    </style>
</head>
<body>
    <div class="box"></div>
</body>
</html>

도움 받은 곳

https://github.com/mdn/css-examples/blob/main/learn/tasks/values/marking.md

https://discourse.mozilla.org/t/assessment-wanted-for-test-your-skills-values-and-units/107339

 

 

 

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 black;
            padding: 1em;
            height: 200px;
            width: 300px;
            overflow: auto;
        }
    </style>
</head>
<body>
    <div class="box">
        <p>
            Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo
            melon azuki bean garlic.
        </p>
    
        <p>
            Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard
            greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.
        </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>
        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 black;
            height: 200px;
            width: 300px;
            overflow: hidden;
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="images/flowers.jpg" alt="flowers">
    </div>
</body>
</html>

 

도움 받은 곳 

https://github.com/mdn/css-examples/blob/main/learn/tasks/overflow/marking.md

 

 

 

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 rebeccapurple;
            background-color: lightgray;
            padding: 40px;
            margin: 40px;
            writing-mode: vertical-rl;
        }
    </style>
</head>
<body>
    <div class="box">Turn me on my side.</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>
        body {
            background-color: #fff;
            color: #333;
            font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif;
            padding: 1em;
            margin: 0;
        }
        
        .vertical {
            writing-mode: vertical-rl;
        }

        .box {
            border: 5px solid rebeccapurple;
            background-color: lightgray;
            padding: 40px;
            margin: 40px;
            inline-size: 200px;
            block-size: 100px;
        }
    </style>
</head>
<body>
    <div class="box">Horizontal.</div>
    <div class="box vertical">Vertical.</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;
        }

        .vertical {
            writing-mode: vertical-rl;
        }

        .box {
            width: 150px;
            height: 150px;
            border-block-start: 5px solid rebeccapurple;
            border-inline-end: 5px solid grey;
            border-block-end: 5px dotted red;
            border-inline-start: 5px dotted blue;
            padding-block-start: 40px;
            margin-block-end: 30px;
        }
    </style>
</head>
<body>
    <div class="box">Horizontal.</div>
    <div class="box vertical">Vertical.</div>
</body>
</html>

 

도움 받은 곳

https://github.com/mdn/css-examples/blob/main/learn/tasks/writing-modes/marking.md

 

 

 

 

 

'CSS > MDN 문제 풀이' 카테고리의 다른 글

Test your skills: Values and units  (0) 2022.11.08
Test your skills: Overflow  (0) 2022.11.07
Test your skills: Backgrounds and borders  (0) 2022.11.07
Test your skills: The box model  (0) 2022.11.06
Test your skills: Selectors  (0) 2022.11.06

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 &amp; 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

+ Recent posts