sticky

· 5년 전 · 3571 · 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,579
5년 전 조회 3,903
5년 전 조회 3,784
5년 전 조회 2,998
5년 전 조회 4,235
5년 전 조회 4,705
5년 전 조회 1.3만
5년 전 조회 4,220
5년 전 조회 3,559
5년 전 조회 4,119
5년 전 조회 5,715
5년 전 조회 6,021
5년 전 조회 3,565
5년 전 조회 1만
5년 전 조회 3,572
5년 전 조회 4,478
5년 전 조회 3,997
5년 전 조회 5,008
5년 전 조회 4,196
5년 전 조회 3,636
5년 전 조회 6,544
5년 전 조회 5,190
5년 전 조회 4,228
5년 전 조회 3,739
5년 전 조회 3,548
5년 전 조회 4,700
5년 전 조회 6,105
5년 전 조회 4,211
5년 전 조회 4,548
5년 전 조회 3,056