Skip to content
TheChatArchiveThe Chat Archive
gpt-4-0314· openaiHugging Face Suzhen/CodeChat

Make the most neat Bootstrap 5.3 sidebar with three mock links

  1. User

    Make the most neat Bootstrap 5.3 sidebar with three mock links

  2. Assistant

    Here's a neat Bootstrap 5.3 sidebar with three mock links:

    First, include the necessary Bootstrap CSS and JS files in <head>:

    <!doctype html>
    <html lang="en">
      <head>
        <!-- Required meta tags -->
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
    
        <!-- Bootstrap CSS -->
        <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    
        <title>Bootstrap Sidebar</title>
      </head>
    <body>
    

    After that, add the following code containing the sidebar and a sample content area inside the body:

    <!-- Container -->
    <div class="container-fluid">
        <div class="row">
            <!-- Sidebar -->
            <div class="col-md-3 col-lg-2 d-md-block bg-light sidebar">
                <nav class="navbar navbar-expand-md navbar-light">
                    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#sidebar">
                        <span class="navbar-toggler-icon"></span>
                    </button>
                    <div class="collapse navbar-collapse" id="sidebar">
                        <ul class="nav flex-column">
                            <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>
                            <li class="nav-item">
                                <a class="nav-link" href="#">Link 3</a>
                            </li>
                        </ul>
                    </div>
                </nav>
            </div>
            <!-- Content -->
            <div class="col-md-9 col-lg-10 ms-sm-auto bg-white">
                <div class="mt-3">
                    <h2>Content Area</h2>
                    <p>Your content goes here ...</p>
                </div>
            </div>
        </div>
    </div>
    

    Finally, add the necessary Bootstrap JS and Popper JS files at the end of the <body>:

        <!-- Bootstrap and Popper JS -->
        <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
    </body>
    </html>
    

    This will create a responsive, neat Bootstrap 5.3 sidebar with three mock links and a content area to the right of the sidebar. The sidebar is collapsible on smaller screens.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.