Location of the html header navigation bar and main content area

Seeking assistance with HTML, CSS, and Bootstrap. I'm trying to create a template for my website that includes a top header, a side navigation bar, and a main section. However, I am struggling to position these elements correctly. The side navbar is appearing in the top right corner instead of below the header, and the main content is displaying under the sidebar. I've experimented with various Bootstrap classes, organizing sections into rows and columns, and have even searched for solutions online without success. Any guidance or insights would be greatly appreciated. Thank you!

<!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>Bootstrap Template</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/dataTables.bootstrap5.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7d1f1212090e090f1c0d50141e12130e3d4c5348534d">[email protected]</a>/font/bootstrap-icons.css">
</head>


<body>
    <div class="wrapper align-items: stretch">
        <!-- top navigation bar -->
        <nav class="navbar navbar-expand-lg bg-white fixed-top border-primary border-bottom border-5">
            <div class="container-fluid">
                <img src="/images/favicon.png" class="rounded float-start" height="45" alt="">
                <a class="navbar-brand me-auto ms-lg-0 ps-3">
                    <h5 class="home_text">Casa Coco </h5>
                </a>
            </div>
        </nav>
        <!-- top navigation bar end-->

        <!-- sidebar -->
        <div class="d-flex flex-column flex-shrink-0 bg-primary sidebar nopadding" style="width: 3.5rem">

            <ul class="nav nav-pills nav-flush flex-column mt-1 text-center">
                <li class="nav-item">
                    <a href="#" class="nav-link active py-3 bg-primary" aria-current="page" title="Home"
                        data-bs-toggle="tooltip" data-bs-placement="right">
                        <i class="bi bi-house-door "></i>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link active py-3 bg-primary" aria-current="page" title="Dashboard"
                        data-bs-toggle="tooltip" data-bs-placement="right">
                        <i class="bi bi-speedometer2"></i>
                    </a>
                </li>
            </ul>
        </div>

        <!-- sidebar end-->

        <div id="content">
            <main class="mt-5 pt-3">
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem mollitia voluptatibus excepturi
                temporibus
                magnam ducimus perspiciatis, quibusdam deserunt vitae maiores doloribus voluptas porro cum, distinctio
                officia,
                natus quod explicabo eum?
            </main>
        </div>
    </div>

    <script src="./js/bootstrap.bundle.min.js" />
    <script src="./js/jquery-3.5.1.js" />
    <script src="./js/jquery.dataTables.min.js" />
    <script src="./js/dataTables.bootstrap5.min.js" />
    <script src="./js/script.js" />


</body>

</html>

Answer №1

This design was crafted using the latest version of Bootstrap - version 5.

<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bedcd1d1cacdcaccdfcefe8b908f908e">[email protected]</a>/dist/js/bootstrap.bundle.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="17757878636463657667572239263927">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet"/>
<!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>Custom Bootstrap Design</title>
    <link rel="stylesheet" href="css/bootstrap.min.css" />
    <link rel="stylesheet" href="css/dataTables.bootstrap5.min.css" />
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="791b16160d0a0d0b180954101a16170a3948574c5749">[email protected]</a>/font/bootstrap-icons.css">
</head>


<body>
    <div class="wrapper align-items: stretch">
    
        <!-- top navigation bar -->
        <nav class="navbar navbar-expand-lg bg-white fixed-top border-primary border-bottom border-5">
        
            <div class="container-fluid">
                <img src="/images/favicon.png" class="rounded float-start" height="45" alt="">
                
                <a class="navbar-brand me-auto ms-lg-0 ps-3">
                    <h5 class="home_text">Casa Coco </h5>
                </a>
                <!-- top nav bar begin -->
                <div class="d-flex">
                    <ul class="nav nav-pills nav-flush flex-row mt-1 text-center">
                <li class="nav-item">
                    <a href="#" class="nav-link active py-3 bg-primary" aria-current="page" title="Home"
                        data-bs-toggle="tooltip" data-bs-placement="right">
                        <i class="bi bi-house-door "></i>
                    </a>
                </li>
                <li class="nav-item">
                    <a href="#" class="nav-link active py-3 bg-primary" aria-current="page" title="Dashboard"
                        data-bs-toggle="tooltip" data-bs-placement="right">
                        <i class="bi bi-speedometer2"></i>
                    </a>
                </li>
            </ul>
                </div>
                <!-- top navigation bar end-->
            </div>
        </nav>
       </div> 
       
     <div id="content" class="container">
            <main style="margin-top:6rem !important">
                Lorem ipsum dolor sit amet consectetur adipisicing elit. Exercitationem mollitia voluptatibus excepturi
                temporibus
                magnam ducimus perspiciatis, quibusdam deserunt vitae maiores doloribus voluptas porro cum, distinctio
                officia,
                natus quod explicabo eum?
            </main>
        </div>   

        




</body>

</html>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for stopping the loading of background images on an image slider

I am utilizing unslider to showcase an image slider on the landing page of my website. The slides are designed with background images in the CSS, and they adjust based on the media query. My concern is that I don't want all the slider images to load a ...

Tips for eliminating unnecessary space in a text area

I have a textarea and a button. I wanted them to be placed in the same horizontal line from the bottom. However, when I place them inline with no style applied, there is extra margin at the bottom of the textarea that is causing them not to align properly: ...

Is it possible to edit the HTML DOM of an external URL that is opened using window.open?

Imagine a scenario where I have a page located at: www.mydomain.com When a user clicks on a button, it triggers the opening of a new window using: newWin = window.open("https://www.otherdomain.com","a","height=800,width=1000"); Now, my objective is to m ...

JavaScript function to toggle visibility and scroll back to top of the page

I have been an avid reader on this platform, and I am hoping that my question has not already been addressed. I am struggling to find a solution to a problem I am facing. There are two DIVs in my code that I toggle between showing and hiding using Javascr ...

Material-UI Swipeable Drawer with a see-through design

Any tips on how to apply a 'transparent' style background property to my SwipeableDrawer component from Material UI? I'm having difficulty changing the background directly from my code since the component generates another component in the H ...

CSS: Centralizing a Div Element with Fluid Width

I've created a popup that appears in the center of the screen using: transform: translate(-50%, -50%); and position: absolute. However, I'm facing an issue where the width of the popup remains fixed instead of adjusting dynamically based on the c ...

Transform Vue.js into static HTML output

Is there a way to convert a Vue.js component into static html without the need for javascript? I am specifically interested in retaining styles. I am searching for a library where I can execute code similar to this: SomeNestedComponent.vue <template> ...

Remain on the current webpage following form submission

I've been attempting to keep the current page active after submitting a form, but for some reason it's not working. After piecing together some code I found online, this is what I have in my process.php file: <?php // Collect Data $name = ...

Having trouble making jQuery code disable input field based on checkbox status

Is there a way to automatically disable the price input field once the checkbox is checked and clear any existing text? I seem to be having trouble with my current code.. <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <scr ...

Modifying the Placeholder Text for Zip Code on the Cart Page in WooCommerce

I am curious about How can I modify the placeholder text for the Zip code on the Cart page? I want it to remain "POSTCODE" even when I click on the Zip code field. Currently, the placeholder text changes to "postcode" once I click on the Zip code field, ...

What is the best way to remove the left margin from a MuiTreeItem-group?

I'm working with the MUI tree component and I want to remove the left margin of the second layer of MuiTreeItem-group I attempted to use makeStyles to address this issue, but it didn't have the desired effect const useStyles = makeStyles(() => ...

Mastering the nav-item class in Bootstrap 4 for optimal navigation functionality

When I look at the examples in the documentation, I have noticed that the .nav-item class is not doing anything when I inspect my nav bar (the class doesn't show up in the console)... Although this isn't a major issue as I can apply my own style ...

The ul class is not aligned with the website logo

My navigation menu items are not appearing inline with the logo on my website. I suspect it might be due to the size of the logo. I've attempted to adjust the width property of the #logo element, but it doesn't seem to be working... Here is a vi ...

Manipulating lines and positions with jQuery

I am looking to implement a feature that allows users to choose a specific region on an image using jQuery. The functionality should be similar to the tagging feature on Facebook, but with the added bonus of being able to rotate and scale the selected area ...

How to Build a Custom Toolbar with Left and Right Aligned Elements using React.js and Material UI

Struggling with updating the toolbar on my website. Wanting the site name and logo on the left side, while login/sign-up buttons fixed to the right. Logo and title are in place, but can't get buttons to stay on right margin. Here's the code: func ...

Ensuring the same height for the navigation bar and logo with aligned vertical text

I'm in the process of recreating a simple navigation menu and I've reached the section where I am encountering an issue with the list items. The orange li element is not filling up 100% of the width, and I also need the links to align in the midd ...

Creating a Consistent Look for Italic Font Formatting in Tailwind

In an effort to establish consistent typography on a website being developed by my team, we have devised custom utility classes in Tailwind. One of these classes, small-italicized, also requires the text to be italicized. However, it seems that the fontSiz ...

The Bootstrap CDN is malfunctioning and displaying errors in the console

I attempted to incorporate Bootstrap 4.5 using the CDN provided on their main website. However, after adding all the code lines to my project, I encountered numerous issues with my custom CSS and the Bootstrap carousel failing to function. Upon inspecting, ...

Achieve full height in Grid component of material UI by eliminating margins

In this codesandbox example, I have successfully set the grid container height to full using 100vh. However, there is an issue with a margin of 8px being added by the user agent to the body element, and I'm struggling to find a solution to remove it. ...

When multiple input fields with an iterative design are using the same onChange() function, the specific event.target.values for each input

I'm in the process of developing a dynamic select button that adjusts based on the information entered into the iterative input fields I've set up. These input fields all utilize the same onChange() function. for (let i = 0; i < selectCount; i ...