Web Frontend/HTML_CSS

[ifp_html_css] Kiwi & Strawberry

홍유진 2022. 6. 2. 03:49

Kiwi

[실행 화면]

 

[소스 코드]

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="stylesheet" href="orange.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Fruit</title>
    <style>
        
    body {
        background-image: url(images/kiwi-bg.jpg);
    }

    div {
        background-color: white;
        width: 600px;
        height: 600px;
        border: 10px solid greenyellow;
        border-radius: 50%;
    }

    img {
        display: block;
        margin: 50px auto 0;
    }

    h1 {
        width: 70px;
        border-bottom: 5px solid greenyellow;
        margin: 0 auto;
    }

    p {
        text-align: center;
        padding-bottom: 20px;
    }

    </style>
</head>
<body>
    <div>
        <img src = 'images/kiwi.png'>
        <h1>Kiwi</h1>
        <p>Hi, this is kiwi's page.</p>
    </div>
    
</body>
</html>

: 오렌지랑 다르게 css를 html 소스 style 안에다가 작성하였다. orange.css에 겹치는 내용들을 다 적어줘서

  링크만 연결하면 된다.


Strawberry

[실행 화면]

[소스 코드]

<!DOCTYPE html>
<html>

<head>
    <title>Strawberry</title>
    <meta charset="uft-8">
    <link rel="stylesheet" href="orange.css">
    <style>
        body {
            background-image: url(images/strawberry-bg.jpg);
        }

        div {
            width: 600px;
            height: 600px;
            border: 10px solid orangered;
            border-radius: 50%;
        }

        img {
            display: block;
            margin: 60px auto 0;
        }

        h1 {
            width: 170px;
            border-bottom: 5px solid orangered;
            margin: 0 auto;
        }

        p {
            text-align: center;
            padding-bottom: 20px;
        }
    </style>
</head>

<body>
    <div>
        <img src="images/strawberry.png">
        <h1>Strawberry</h1>
        <p>Hi, this is Strawberry's page.</p>
    </div>
</body>

</html>