2022 summer-vacation HTML&CSS seminar: week2

가오리·2022년 11월 19일
0

seminar

목록 보기
7/15
post-thumbnail

  • index.html
    <!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>DIVIDE</title>
        <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
        <article class="bigBox">
          <div class="box"></div>
          <div class="box" id="long"></div>
          <div class="box"></div>
        </article>
      </body>
    </html>
  • style.css
    body {
      width: 100vw;
      height: 100vh;
      margin: 0;
      padding: 0;
      background-color: rgb(255, 98, 0);
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .bigBox {
      background-color: rgb(226, 223, 200);
      width: 500px;
      height: 500px;
      display: flex;
      justify-content: space-around;
      align-items: center;
      flex-direction: column;
    }
    .box {
      width: 100px;
      height: 100px;
      background-color: rgb(19, 61, 18);
      border: 5px solid white;
    }
    #long {
      width: 400px;
      border: 5px dashed white;
    }

  • index.html
    <!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>Robot</title>
        <link rel="stylesheet" href="./style.css" />
      </head>
      <body>
        <article class="red_robot">
          <section>
            <img src="./img/robot-red.png" alt="Cars" />
            <div>
              <h1>RED</h1>
              <p>
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Quod,
                corporis blanditiis earum porro maiores ratione.
              </p>
            </div>
          </section>
          <footer>
            <a href="https://www.youtube.com/watch?v=8quCMBWbauA">LAUNCH</a>
          </footer>
        </article>
        <article class="green_robot">
          <section>
            <img src="./img/robot-green.png" alt="Androboi" />
            <div>
              <h1>GREEN</h1>
              <p>
                Lorem ipsum dolor, sit amet consectetur adipisicing elit. Numquam
                dolores dolore voluptatibus odio consequatur quis?
              </p>
            </div>
          </section>
          <footer>
            <a href="https://www.youtube.com/watch?v=WIgFjRQBuo0">LAUNCH</a>
          </footer>
        </article>
        <article class="blue_robot">
          <section>
            <img src="./img/robot-blue.png" alt="Doraemon" />
            <div>
              <h1>BLUE</h1>
              <p>
                Lorem ipsum dolor sit amet consectetur, adipisicing elit. Iste rem
                ipsa natus laudantium nam amet?
              </p>
            </div>
          </section>
          <footer>
            <a href="https://www.youtube.com/watch?v=6zmxzJFZxMI">LAUNCH</a>
          </footer>
        </article>
      </body>
    </html>
  • style.css
    body {
      margin: 0;
      padding: 0;
      background-color: rgb(92, 92, 92);
      width: 100vw;
      height: 100vh;
      display: flex;
      justify-content: center;
      align-items: center;
    }
    article {
      width: 300px;
      height: 350px;
      background-color: white;
      color: rgb(180, 180, 180);
      text-align: center;
      margin-top: 200px;
    }
    img {
      width: 200px;
      margin-top: -230px;
    }
    h1 {
      display: inline-block;
      font-size: 30px;
    }
    section {
      height: 280px;
    }
    /* each class */
    .green_robot {
      margin-left: 20px;
      margin-right: 20px;
    }
    .red_robot h1 {
      background-color: rgb(255, 238, 199);
      border-top: 5px solid tomato;
      border-bottom: 5px solid tomato;
      color: tomato;
    }
    
    .green_robot h1 {
      background-color: rgb(255, 238, 199);
      border-top: 5px solid rgb(71, 170, 48);
      border-bottom: 5px solid rgb(71, 170, 48);
      color: rgb(71, 170, 48);
    }
    .blue_robot h1 {
      background-color: rgb(255, 238, 199);
      border-top: 5px solid rgb(71, 114, 255);
      border-bottom: 5px solid rgb(71, 114, 255);
      color: rgb(71, 114, 255);
    }
    /* footer */
    footer {
      height: 70px;
      background-color: rgb(199, 199, 199);
      display: flex;
      justify-content: center;
      align-items: center;
    }
    a {
      width: 100px;
      height: 30px;
      line-height: 30px;
      text-decoration: none;
      font-size: 18px;
      color: white;
    }
    /* each class a */
    .red_robot a {
      background-color: tomato;
      border-bottom: 3px solid rgb(183, 70, 50);
    }
    .green_robot a {
      background-color: rgb(71, 170, 48);
      border-bottom: 3px solid rgb(48, 114, 33);
    }
    .blue_robot a {
      background-color: rgb(71, 114, 255);
      border-bottom: 3px solid rgb(52, 84, 188);
    }
    .red_robot a:active,
    .green_robot a:active,
    .blue_robot a:active {
      margin-bottom: -5px;
      border-bottom: none;
    }




Negative margins

→ 문서 내의 정상적인 흐름을 건들이지 않는다

→ 요소를 이동하려고 음수 마진을 사용하면 그 뒤에 오는 모든 요소들도 같이 이동

→ 음수 패딩 사용 시 테두리가 내용으로 축소, 내용 영역이 내용보다 작아지기 때문에 의미 없음

:active

→ 사용자가 활성화한 요소를 나타낸다

→ 버튼을 누르는 순간부터 떼는 시점까지

→ link→ visited → hover → active 순서로 디자인하기

@import

→ 다른 스타일 시트에서 스타일 규칙을 가져올 때 쓴다

@import url("bluish.css") speech;
@import url("chrome://communicator/skin/");
profile
가오리의 코딩일기

0개의 댓글