[스파르타] HTML은 뼈대, CSS는 꾸미기!

이용찬·2021년 11월 10일
0

내일배움단

목록 보기
1/14
post-thumbnail

HTML은 뼈대, CSS는 꾸미기!

01. HTML 기초

HTML은 크게 headbody로 구성되며, head안에는 페이지 속성 정보를, body안에는 페이지의 내용을 담습니다.

Test. 로그인 페이지 만들기

html 코드

<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <title>로그인 페이지</title>
</head>
<body>
    <p><h1>로그인 페이지</h1></p>
    <p>ID: <input type="text"/></p>
    <p>PW: <input type="text"/></p>
    <button>로그인하기</button>
</body>

</html>

02. CSS 기초

CSS 어떻게 사용하는 건가요?`

<head> ~ </head> 안에 <style> ~ </style> 로 공간을 만들어 작성합니다.

Test. CSS 사용하기

html 코드

<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <title>로그인페이지</title>

    <style>
        .mytitle {
            color: red;
            width: 400px;
            height: 300px;
            text-align: center;

            background-image: url("https://www.ancient-origins.net/sites/default/files/field/image/Agesilaus-II-cover.jpg");
            background-size: cover;
            background-position: center;

            border-radius: 10px;
            padding-top: 20px;
        }
        .mybtn {
            padding: 5px;
            width: 200px;
            margin: auto;
            display: block;
        }
        .wrap {
            width: 400px;
            margin: auto;
        }
        .blue-font {
            color: blue;
            font-size: 30px;
        }
    </style>
</head>
  
<body>
    <div class="wrap">
        <div class="mytitle">
            <h1>로그인 페이지</h1>
            <h5>아이디, 패스워드를 입력해주세요.</h5>
        </div>
        <p>ID: <input type="text"/></p>
        <p>PW: <input type="text"/></p>
        <button class="mybtn blue-font">로그인하기</button>
    </div>
</body>
  
</html>

03. 구글 웹폰트 사용

폰트는 요기!

Test. 폰트 적용하기

html 코드

<!DOCTYPE html>
<html lang="en">
  
<head>
    <meta charset="UTF-8">
    <title>로그인페이지</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Dongle&family=Yeon+Sung&display=swap" rel="stylesheet">
    <style>
        * {
            font-family: 'Dongle', sans-serif;
            font-family: 'Yeon Sung', cursive;
        }
        .mytitle {
            background-color: yellow;
            color: red;

            width: 400px;
            height: 300px;
            text-align: center;

            background-image: url("https://www.ancient-origins.net/sites/default/files/field/image/Agesilaus-II-cover.jpg");
            background-size: cover;
            background-position: center;

            border-radius: 10px;
            padding-top: 20px;
        }
        .mybtn {
            padding: 5px;
            width: 200px;
            margin: auto;
            display: block;
        }
        .wrap {
            width: 400px;
            margin: auto;
        }
        .blue-font {
            color: blue;
            font-size: 30px;
        }
    </style>
</head>
  
<body>
    <div class="wrap">
        <div class="mytitle">
            <h1>로그인 페이지</h1>
            <h5>아이디, 패스워드를 입력해주세요.</h5>
        </div>
        <p>ID: <input type="text"/></p>
        <p>PW: <input type="text"/></p>
        <button class="mybtn blue-font">로그인하기</button>
    </div>
</body>
  
</html>

04. 느낀점

HTML 꿀잼!

profile
안녕하세요. 클래식을 즐기는 개발자, 이용찬입니다.

0개의 댓글

Powered by GraphCDN, the GraphQL CDN