728x90
반응형
Navbar with Dropdown
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.js"></script>
    <style>
        .form-inline{margin:auto 0 auto auto;}
        /* .form-inline{margin:auto;} */
    </style>
</head>
<body>
    <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
        <!-- Brand -->
        <a class="navbar-brand" href="#">Logo</a>
        <!-- Links -->
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="#">Link 1</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Link 2</a>
            </li>
            <!-- Dropdown -->
            <li class="nav-item dropdown">
                <div class="nav-link dropdown-toggle" data-toggle="dropdown">Dropdown link
                    </div>
                    <div class="dropdown-menu">
                        <a class="dropdown-item" href="#">Link 1</a>
                        <a class="dropdown-item" href="#">Link 2</a>
                        <a class="dropdown-item" href="#">Link 3</a>
                    </div>
            </li>
        </ul>
        <form class="form-inline" action="#">
            <input class="form-control mr-sm-2" type="text" placeholder="Search">
            <button class="btn btn-success" type="submit">Search</button>
        </form>
    </nav>
    <br>

    <div class="container">
        <h3>Navbar With Dropdown</h3>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
    </div>
</body>
</html>​

navbar top만 고정
브라우저 좌우너비에 따라 컨텐츠 일부 이동됨

 

 

Top fixed Navbar
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.js"></script>
    <style>
        .navtop {position:fixed; top:0; left:0; width:100%;}
    </style>
</head>
<body style="height: 1500px;">
    <!-- <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-bottom"> -->
    <!-- <nav class="navbar navbar-expand-sm bg-dark navbar-dark navtop"> -->
    <nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
        <!-- fixed-top : 브라우저 상단 팝업고정 z-index:1030; -->
        <a class="navbar-brand" href="#">Logo</a>
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="#">Link 1</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Link 2</a>
            </li>
        </ul>
    </nav>
    <br>

    <div class="container" style="margin-top:80px;">
        <h1>Top Fixed Navbar</h1>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
    </div>
</body>
</html>
</head>
<body>
    
</body>
</html>​

 

 

;;
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.js"></script>

</head>
<body style="height: 1500px;">
    <div class="container-fluid">
        <br>
        <h1>Sticky Navbar</h1>
        <p>navbar의 상단 위치가 브라우저의 top에위치하면 붙어서 그대로 유지된다.</p>
        <p>IE11 이전의 버전에서는 이 클래스가 작동하지 않는다.</p>
        </div>
    

    <nav class="navbar navbar-expand-sm bg-dark navbar-dark sticky-top">
        <a class="navbar-brand" href="#">Logo</a>
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link" href="#">Link 1</a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="#">Link 2</a>
            </li>
        </ul>
    </nav>

    <div class="container"><br>
        <h1>Top Fixed Navbar</h1>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>

        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
        <p>This example adds a dropdown menu in the navbar.</p>
    </div>
</body>
</html>
</head>
<body>
    
</body>
</html>​
728x90
반응형

'[JS]' 카테고리의 다른 글

[Bootstrap] modal  (0) 2024.03.12
[Bootstrap] carousel, icon  (0) 2024.03.12
[Bootstrap] form validation  (0) 2024.03.11
[Bootstrap] grid, button  (0) 2024.03.11
[Bootstrap] container, col  (0) 2024.03.11

+ Recent posts