Problems arising from positioning elements with CSS and organizing list items

I've been working on creating a navigation sidebar using Angular and Bootstrap, but I'm having trouble getting my navigation items to display correctly.

APP Component HTML

<div class="container-fluid">

  <div class="row" id="header">
    <div class="col-md-12">
      <app-admin-header></app-admin-header>
    </div>
  </div>

  <div class="row">
    <div class="col-md-2" id="sidebar-parent">
      <app-sidebar-menu></app-sidebar-menu>
    </div>
    <div class="jumbotron col-md-10" id="content-parent">
        <router-outlet></router-outlet>
    </div>
  </div>

</div>

APP Component CSS

#sidebar-parent {
  position:relative;
  top:0;
  left:0;
}
#content-parent {
  position:relative;
  top:0;
  left:0px;
}

HEADER HTML

<div id="header-wrapper">

    <nav class="navbar navbar-expand-lg navbar-light bg-light">

        <!--button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-c...
        <div class="col-md-12">
          <ul class="navbar-nav ml-auto">
            <li class="sidebar-brand">
              <a href="#">
              </a>
            </li>
            <li class="nav-item active">
              <a class="nav-link" href="#">Home
                <span class="sr-only">(current)</span>
              </a>
            </li>
            <li class="nav-item active">
              <a class="nav-link" href="#">Coupons</a>
            </li>
          </ul>
        </div>
    </nav>

</div>

HEADER CSS

#header-wrapper {
  background: #35acdf;
  margin-bottom: 7px;
}

.navbar {
  background: #35acdf;
}

SIDEBAR HTML

<div id="page-wrapper">
  <div id="page-viewport">
    <div id="sidebar">
      <div id="sidebar-header">
        <a href="#" class="toggle-sidebar">Sidebar
          <span class="pull-right">
            <a href="#" class="toggle-sidebar btn btn-default">
              <span class="fa fa-bars"></span>
            </a>
          </span>
        </a>
      </div>

         <ul class="nav nav-pills nav-stacked">
          <li><a href="#" routerLink="dashboard"><span class="fa fa-shopping-bag"></span>&emsp;Dashboard</a></li>
          <li><a href="#" routerLink="categories"><span class="fa fa-list"></span>&emsp;Categories</a></li>
          <li><a href="#"><span class="fa fa-lock"></span>&emsp;Companies</a></li>
          <li><a href="#"><span class="fa fa-industry"></span>&emsp;Coupons</a></li>
          <li><a href="#" routerLink="product"><span class="fa fa-male"></span>&emsp;Products</a></li>
          <li><a href="#"><span class="fa fa-list"></span>&emsp;Sales</a></li>
          <li><a href="#"><span class="fa fa-lock"></span>&emsp;Deals</a></li>
        </ul>

       </div>
  </div>

</div>

SIDEBAR CSS

#page-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  left: 0;
}

#page-viewport {
  position: relative;
  width: 100%;
  height: 100%;
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

#sidebar {
  position: relative;
  width: 100%;
  height: 100%;
  left: 0px;
  border-right: 1px solid #f0f0f0;
  background-color: #f9f9f9;
  padding-left: 15px;
  list-style: none;
}

#sidebar h3 {
  display:inline;
  position:relative;
  top:5px;
  left:5px;
}

#sidebar a:hover {
  text-decoration:none;
}

#sidebar-header {
  height: 40px;
  border-bottom:1px solid #f0f0f0;
}

.sidebar li {
  position: absolute;
  line-height: 20px;

  width: 100%;
  padding: 10px 0 10px 20px;
}

#page-wrapper.show-sidebar #page-viewport {
  -webkit-transform: translateX(200px);
}

#page-wrapper.show-sidebar #sidebar-page-content {
  width: -webkit-calc(100% - 250px);
}

You can check out the screenshot here.

The issue I'm facing is that certain list items like "Products" and "Deals" are not appearing on their own separate lines as expected.

Answer №1

If you want to change the default layout of a Bootstrap navigation bar, simply use the .nav class with display: flex; flex-wrap;. To make it vertical, add the flex-column class to your nav element. More information can be found in the documentation: https://getbootstrap.com/docs/4.2/components/navs/#vertical

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

What is the process for calculating a class property in typescript?

If I were writing this in JavaScript, it would look like: function a(b,c) {this.foo = b; this.bar = c; this.yep = b+c} // undefined b = new a(1,2) // a {foo: 1, bar: 2, yep: 3} However, I've been struggling to achieve the same in TypeScript. None of ...

Unstyled Cards Failing to Receive Design

I am currently working on creating a prototype that utilizes two Bootstrap 4 cards to display information from a form and store related information from another form in the second card. The current layout of this setup can be observed below: This JSFiddle ...

Launching an image link within the same location on the subsequent page to which it is directed

I'm completely new to creating websites so I may not be using the correct terminology. I've searched with various terms and ideas but haven't found any solutions to help me ask my question effectively or find examples of what I'm lookin ...

Links in words not redirecting to asp.net documents

I have a collection of Word files that require hyperlinks. These hyperlinks lead to an htm file with an anchor, however the htm file is not accessible directly via a URL for security purposes. Instead, it links to an ashx handler file which fetches the f ...

The customized Vaadin component with a tag is missing from the MainView layout

I am attempting to integrate my custom vis component into the MainView VerticalLayout. However, it is appearing above the layout and the layout itself contains an empty component tag. Custom component code In this section, I have labeled my component as " ...

transmit static information using a form

I'm currently working on sending data from one page of my website to another. It seems like using an HTML form with the action attribute set to the destination would be the way to go. <form method="POST" action="/destination"> <input ty ...

The term "landscape" to address the issue of adjusting the Android app screen to display in landscape orientation is not being acknowledged

I am working on an Android app using HTML5 and Cordova. I've included the following code in the manifest.json file as a reference. However, I'm facing an issue where the app screen does not stay fixed horizontally. It only turns sideways when th ...

Navigational Menu in PHP

My goal is to have one link that retrieves data from a table with a specific value and another identical link that pulls data from the same table but with a different value. However, both dropdowns are displaying in the link. <div class="col-sm-9"> ...

When the pathway is void, it becomes impossible to redirect to the designated component

I recently developed a code that is supposed to redirect to a specific component when the application starts. const routes: Routes = [ {path: 'home', component: HomeComponent}, {path: 'content', loadChildren: 'app/componen ...

Saving the output of an AngularJS expression in an input field

Looking at the calculations below, I am currently evaluating an expression, {{ annualIncome * 4.5 }}, in one input and then re-evaluating the same expression in another input. Instead of saving the result and transferring it to the other input, I am repeat ...

Trigger a change event for a Material Checkbox by referencing its unique identifier

<div *ngFor="let cus of deselectedList | keyvalue" (click)="clickCheckBox('customer_'+cus.key+'_checkbox')"> {{cus.key}} <mat-checkbox id="customer_{{cus.key}}_checkbox" (change ...

What are the steps to generate a customizable datatable with various columns and information?

My application allows users to select options from a dropdown menu, which triggers a request and displays the output - typically a table - on the website. The data is always in JSON format, like the examples shown below: '{"columns":["C1","C2"], "dat ...

Having trouble with downloading a zipped folder on the client side in an Angular and Node.js (MEAN) application

I am facing an issue with allowing users to download compressed folders from the server. I have successfully compressed the folder, however, when attempting to read the tar file and send it for download on the client side, the file is either corrupted or o ...

Is there a way to have the menu displayed on a single line and consistently centered?

I am working on a menu that needs to stay centered at the top of the screen, with a consistent appearance and just one line, regardless of the screen width. However, I'm encountering an issue where the menu mysteriously transitions into a two-line for ...

Deactivate particular JavaScript when displaying a Bootstrap modal

On mobile devices, I have JavaScript that is preventing vertical panning on modals, resulting in users not being able to see all the modal content. Is there a way to disable this JavaScript when a modal is displayed? The following snippet of JavaScript a ...

The Node.js application is having trouble connecting to the Angular application on port 3000 when the Angular app is hosted on a remote machine

I'm facing an issue with my Nodejs app not being able to connect with the Angular app on port 3000 when the Angular app is hosted on a remote machine. However, everything works fine when both apps (Nodejs and Angular) are hosted on the same machine. C ...

Ways to determine if an element is the initial child

I am currently facing issues while attempting to make my bootstrap carousel dynamic and inject data properly. My aim is to locate the first child of the injected data and apply the "active" class to it. I am utilizing Laravel Blade for rendering my data. B ...

The compiler is unable to locate the node_module (Error: "Module name not found")

Error: src/app/app.component.ts:4:12 - error TS2591: Cannot find name 'module'. Do you need to install type definitions for node? Try npm i @types/node and then add node to the types field in your tsconfig. 4 moduleId: module.id, When att ...

Prevent the page from scrolling while the lightbox is open

I am struggling with a lightbox that contains a form. Everything is functioning properly, but I need to find a way to prevent the HTML page from scrolling when the lightbox is active. <a href = "javascript:void(0)" onclick=" document.getElementById(& ...

Navigating through sibling elements can be accomplished by using various methods in

Can someone help me figure out how to assign unique IDs to 6 different Div elements as I step through them? The code snippet below is not working as expected, giving all Divs the same ID. What is the correct way to accomplish this task? $('#main-slid ...