210618 UIUX WebDesign CSS 연습_44

ITisIT210·2021년 6월 20일
0

CSS

목록 보기
51/93
post-thumbnail
<!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>GNB</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        ol,
        ul {
            list-style: none;
        }

        a {
            text-decoration: none;
            color: #000;
        }

        table {
            border-collapse: collapse;
        }

        body {
            font-family: "맑은 고딕";
            font-size: 16px;
            color: #000;
            line-height: 1.5;
        }

        .gnb {
            margin: 50px auto;
            width: 1000px;
        }
        
        .gnb li {
            width: calc(100% / 4);  /* 상위 요소 너비의 4분의 1씩 나눔 */
            float: left;    /* 가로 배치 */
            background-color: #ddd;
            border-radius: 30px;
        }
        
        .gnb li a {
            padding: 50px 0px;
            display: block;
            text-align: center;
            border-right: 2px solid #fff;
        }
        .gnb li:nth-child(1) a:hover {
            color: #fff;
            border-radius: 30px;
            /* 그라디언트(직선형(linear-gradient(#시작 색상 값1,#끝 색상 값2)), 원형(radial-gradient(#시작 색상 값1,#끝 색상 값2))) 색상 */
            background: linear-gradient(#73effe, #027fd2);    /* 위에서 아래로 (to bottom) */
            /* background: radial-gradient(#73effe, #027fd2); */  /* 중심에서 바깥으로 */
            /* background: linear-gradient(to right, #ddd, #000); */    /* 왼쪽에서 오른쪽으로 (to right) */
        }
        .gnb li:nth-child(2) a:hover {
            color: #fff;
            border-radius: 30px;
            background: linear-gradient(#67feb6, #1aa8ad);    /* 위에서 아래로 (to bottom) */
        }
        .gnb li:nth-child(3) a:hover {
            color: #fff;
            border-radius: 30px;
            background: linear-gradient(#fef192, #f38281);    /* 위에서 아래로 (to bottom) */
        }
        .gnb li:nth-child(4) a:hover {
            color: #fff;
            border-radius: 30px;
            background: linear-gradient(#f8a3fe, #7d54da);    /* 위에서 아래로 (to bottom) */
        }
    </style>
</head>

<body>
    <!-- GNB (Global Navigation Bar) -->
    <ul class="gnb">
        <li><a href="#">상단메뉴1</a></li>
        <li><a href="#">상단메뉴2</a></li>
        <li><a href="#">상단메뉴3</a></li>
        <li><a href="#">상단메뉴4</a></li>
    </ul>
</body>

</html>
profile
Engineering is the closest thing to magic that exists in the world.

0개의 댓글