본문 바로가기
Web/CSS

[CSS] 디스플레이(display) 속성, 폼(form) 알아보기!

by coding-choonsik 2023. 3. 31.
728x90
반응형
SMALL

1. css 디스플레이

  • 웹 페이지의 레이아웃을 결정하는 속성
  • block
  • inline
  • inline-block
  • none

✔ visibility: hidden; -> visibility: visible;

 

<!DOCTYPE html>
<html lang="en">
<head>
    <title>디스플레이</title>
    <style>
        div {
            background-color: wheat;
            border: 3px solid salmon;
            margin-bottom: 30px ;
        }
        p#none {display: none;}
        p#hidden {visibility: hidden;}
    </style>
</head>
<body>
    <h2>디스플레이</h2>
    <div>
        <p>display 속성값을 none으로 설정</p>
        <p id="none">display 속성값을 none으로 설정</p>
    </div>
    <div>
        <p>display 속성값을 hidden으로 설정</p>
        <p id="hidden">display 속성값을 hidden으로 설정</p>
    </div>
</body>
</html>


2. css 폼

  • 폼 요소의 스타일 설정
<!DOCTYPE html>
<html lang="en">
<head>
    <title>폼</title>
    <style>
        .input {
            box-sizing: border-box;
            width: 100%;
            background-color: wheat;
            padding: 10px 20px;
            margin: 5px 0;
        }
        input[type="text"] {
            border-radius: 10px;
        }
        input[type="text"]:focus {
            background-color: palegoldenrod;
            border:3px dotted olivedrab ;
        }
        input[type="password"] {
            border: none;
            background-color: aliceblue;
            border-bottom: 3px solid black;
        }
        input[type="password"]:focus {
            border: none;
            background-color: aliceblue;
            border-bottom: 3px dotted black;
        }
        select {
            box-sizing: border-box;
            width: 100%;
            padding: 10px;
            background-color: pink;
            margin: 5px 0;
            border: 2px solid red;
            cursor: pointer;
        }
        textarea#content {
            box-sizing: border-box;
            width: 100%;
            height: 200px;
            resize: none;
            font-size: 20px;
        }
        button.btn {
            width: 150px;
            background-color: palegreen;
            color: green;
            padding: 12px 25px;
            cursor: pointer;
            border: none;
        }
        p.center { text-align: center;}
    </style>
</head>
<body>
    <h2>폼</h2>
    <form action="#">
        <p>아이디: <input type="text" id="userid" class="input" maxlength="20" placeholder="아이디를 입력하세요"></p>
        <p>비밀번호: <input type="password" id="userpw" class="input" maxlength="20" placeholder="비밀번호를 입력하세요"></p>
        <p>직업:
            <select>
                <option value="프로그래머">프로그래머</option>
                <option value="디자이너">디자이너</option>
                <option value="학생">학생</option>
                <option value="공무원">공무원</option>
                <option value="유튜버">유튜버</option>
            </select>
        </p>
        <p><textarea id="content"></textarea></p>
        <p class="center"><button class="btn">회원가입</button></p>

    </form>
</body>
</html>

 

728x90
반응형
LIST