sticky

· 5년 전 · 3496 · 3

오늘 노마드코더에서 본건데 꿀팁이네요

position: sticky;

아래 코드 실행해서 스크롤 해보세요

 

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

        html, body {

            margin: 0;

            padding: 0;

        }

        header {

            background: #0f0;

            line-height: 100px;

            text-align: center;

        }

        nav {

            background: #0af;

            top: 0;

            position: sticky;

            line-height: 30px;

            text-align: center;

        }

        .main {

            background: #1a1;

            height: 2000px;

            text-align: center;

        }

        footer {

            background: #834;

            text-align: center;

        }

    </style>

</head>

<body>

    <header>

        header

    </header>

    <nav>

        nav

    </nav>

    <div class="main">

        aaaa

    </div>

    <footer>

        Footer

    </footer>

</body>

</html>

|

댓글 3개

아직 IE는 지원이 안되서 아쉽지만 그래도 좋은 기능이네요ㅎㅎㅎ
저는 이제 점유율 10% 이하인 ie는 버린지 오랩니다.
좋은정보 감사합니다 ^^
댓글을 작성하시려면 로그인이 필요합니다.

그누보드5 팁자료실

+
제목 글쓴이 날짜 조회
5년 전 조회 4,511
5년 전 조회 3,819
5년 전 조회 3,713
5년 전 조회 2,929
5년 전 조회 4,154
5년 전 조회 4,633
5년 전 조회 1.3만
5년 전 조회 4,119
5년 전 조회 3,475
5년 전 조회 4,037
5년 전 조회 5,640
5년 전 조회 5,940
5년 전 조회 3,471
5년 전 조회 1만
5년 전 조회 3,497
5년 전 조회 4,410
5년 전 조회 3,925
5년 전 조회 4,913
5년 전 조회 4,133
5년 전 조회 3,571
5년 전 조회 6,436
5년 전 조회 5,091
5년 전 조회 4,152
5년 전 조회 3,655
5년 전 조회 3,481
5년 전 조회 4,617
5년 전 조회 6,029
5년 전 조회 4,136
5년 전 조회 4,479
5년 전 조회 3,000