하늘뚱

간단한 Flex 활용 예제

· 2023-03-14 (화) 14:52:19 · 2467 · 1

개인적으로 Flex 관련 공부하다 예제가 있어서 올립니다.

[code]

<!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>test03.html</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"
      integrity="sha512-MV7K8+y+gLIBoVD59lQIYicR65iaqukzvf/nwasF0nqhPay5w/9lJmVM2hMDcnK1OnMGCdVK+iQrJ7lzPJQd1w=="
      crossorigin="anonymous"
      referrerpolicy="no-referrer"
    />
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        background-color: #333;
      }
      .buttons {
        display: flex;
        justify-content: center;
        align-items: center;
        flex-wrap: wrap;
        max-width: 140px;
        gap: 20px;
      }
      .buttons label {
        position: relative;
        width: 60px;
        height: 60px;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
      }
      .buttons label input {
        appearance: none;
      }
      .buttons label span {
        position: absolute;
        width: 100%;
        height: 100%;
        background: linear-gradient(#555353, #363535, #303030);
        border: 2px solid #222;
        border-radius: 6px;
        box-shadow: inset 0 5px 1px rgba(0, 0, 0, 0.35), 0 5px 5px rgba(0, 0, 0, 0.5), 0 15px 25px rgba(0, 0, 0, 0.35);
      }
      .buttons label input:checked ~ span {
        box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.35), inset 0 5px 5px rgba(0, 0, 0, 0.5),
          inset 0 15px 25px rgba(0, 0, 0, 0.35);
      }
      .buttons label span::before {
        content: "";
        position: absolute;
        inset: 5px 3px;
        border-top: 1px solid #ccc;
        filter: blur(2px);
      }
      .buttons label i {
        position: relative;
        z-index: 10;
        font-size: 1.5em;
        color: #111;
      }
      .buttons label input:checked ~ i {
        color: #fff;
        text-shadow: 0 0 5px #219cf3, 0 0 8px #219cf3;
      }
    </style>
  </head>
  <body>
    <div class="buttons">
      <label>
        <input type="checkbox" name="check" />
        <span></span>
        <i class="fa-solid fa-phone"></i>
        <!-- <i class="fa-solid fa-phone"></i> -->
      </label>
      <label>
        <input type="checkbox" name="check" />
        <span></span>
        <i class="fa-solid fa-plane"></i>
        <!-- <i class="fa-solid fa-phone"></i> -->
      </label>
      <label>
        <input type="checkbox" name="check" />
        <span></span>
        <i class="fa-solid fa-moon"></i>
        <!-- <i class="fa-solid fa-phone"></i> -->
      </label>
      <label>
        <input type="checkbox" name="check" />
        <span></span>
        <i class="fa-solid fa-wifi"></i>
        <!-- <i class="fa-solid fa-phone"></i> -->
      </label>
    </div>
  </body>
</html>

[/code]

|

댓글 1개

적용해 보시고 그누보드 테마로 적용해 보실려면 댓글 달아 주세요.ㅎㅎㅎ
댓글을 작성하시려면 로그인이 필요합니다.

퍼블리셔팁

1,282건

퍼블리싱과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
레이아웃 23-06-12 조회 2,324
웹접근성 23-06-09 조회 2,829
레이아웃 23-06-08 조회 2,206
레이아웃 23-06-08 조회 3,963
기타 23-05-30 조회 1,678
레이아웃 23-05-23 조회 2,076
레이아웃 23-05-24 조회 1,632
레이아웃 23-05-25 조회 2,521
레이아웃 23-05-26 조회 2,064
HTML 23-05-11 조회 2,321
HTML 23-04-23 조회 1,492
HTML 23-03-16 조회 1,739
HTML 23-03-14 조회 1,715
HTML 23-03-14 조회 2,468
CSS 23-03-13 조회 1,827
CSS 23-03-13 조회 2,347
CSS 23-03-02 조회 2,293
HTML 23-02-26 조회 1,729
기타 23-02-26 조회 1,377
CSS 23-02-19 조회 1,582
기타 23-02-03 조회 2,772
CSS 23-01-03 조회 2,458
CSS 22-12-17 조회 2,451
반응형 22-10-22 조회 1,750
반응형 22-09-06 조회 4,919
웹접근성 22-06-29 조회 2,214
반응형 22-06-29 조회 2,576
CSS 22-06-29 조회 2,059
HTML 22-06-09 조회 2,267
HTML 22-05-11 조회 1,843