Attach bread crumbs to the top of the page

I want to attach breadcrumbs to the top of the navbar. Currently, I am developing an application using Angular and Bootstrap 4.

app.component.html

<nav class="navbar navbar-expand-lg navbar-toggleable-lg navbar-dark bg-dark sticky-top" style="position:sticky">
  <!--navbar-expand-sm navbar-dark bg-dark sticky-top -->


  <!-- Important - make sure to have the toggler button outside of the container -->
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse">
    <!--aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation"-->
    <span class="navbar-toggler-icon"></span>
  </button>
  <div>

    <span class="navbar-text" style="color:white">Header</span>
  </div>
</nav>

<div class="container-fluid" style="padding-left:0px;">
  <div class="row">
    <div class="col-12 col-xl-2 col-lg-3 col-md-4">
      <div class="col-xl-12 col-lg-12 col-md-12 x1-sidebar bg-dark" style="position:sticky;">
        <app-navbar></app-navbar>
      </div>
    </div>
    <div class="col">
      <router-outlet></router-outlet>
    </div>
  </div>
</div>

The app-navbar is a vertical navigation component.

The router-outlet represents the main content which includes dynamic breadcrumbs and content.

Below are the breadcrumbs and content:

<div class="container">
    <div class="row" *ngIf="breadCrumbs?.length>0" style="position:inherit;">
        <div class="col">
            <nav aria-label="breadcrumb">
                <ul class="breadcrumb bg-dark sticky-top" >
                    <li class="breadcrumb-item" *ngFor='let breadcrumb of breadCrumbs; let i = index' >
                        <a >{{ Dynamic breadcrumb label }}</a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
    <div class="row">
        <div class="col">
            //content.......
        </div>
    </div>
</div>

If the code is unclear, please let me know so I can provide more information.

Answer №1

Incorporate the following CSS snippet:

.navigation {
    position: fixed;
    top: 50px;
    width: 100%;
}

Make sure to modify the number 50 based on the height of your header.

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

Differences in HTML animations can be seen when comparing Google Chrome to Microsoft Edge. Looking for a workaround for autoplay to ensure

My intro video animation is facing recording difficulties due to the autoplay policy in Google Chrome. It seems nearly impossible to capture it accurately. If only autoplay could function for an offline HTML file, my issue would be resolved. Unfortunately ...

Angular - Implementing *ngIf based on URL parameters

Is it possible to display an element based on specific queryParams included in the URL? For example: ngOnInit() { this.route.queryParams.subscribe(params => { console.log(params); }); } If I want to achieve something similar to this: ...

The close button on the modal vanishes on a real iPhone

The issue I am facing is that the Close Button appears when testing responsiveness in Chrome, but disappears on a real iPhone. When clicking on an image, the image gallery should appear. However, on an iPhone, only the previous and next buttons are visibl ...

Firefox is having trouble loading SVG files

For some reason, the SVG image is loading on all browsers except for Firefox. I checked the DOM but couldn't find the code. Just to clarify, I am serving the page from Tomcat 9.0.34 <kendo-grid grid-options="gridOptions"> <img src= ...

What is the best way to align the left div with the right div?

Here's the challenge: I want to make the left div stretch to the height of the right div https://i.sstatic.net/R3MCY.png and here's the desired outcome https://i.sstatic.net/UAXWC.png Currently, I'm implementing this using bootstrap < ...

Employing flexbox to allow columns to shrink only when their width exceeds half of the container's size

Can you take a look at my drawing? Here is the scenario I'm trying to achieve: (1) I have a flexbox with two columns. If one box is bigger than half the width and there is enough space for both boxes, they should remain unchanged (or stretch propor ...

Turning an angular API into a synchronous one: A step-by-step guide

My goal is to perform consecutive http calls to a REST service, with each call requiring a unique valid token in the header. The challenge arises when multiple components initialize simultaneously and make "get" calls at the same time using the same token. ...

Loop through a JSON array in an Ionic framework to show every piece of information

1- Image link for result of JSON data I have a JSON data array and I am able to display an individual part of the array in my HTML code. However, I am struggling with displaying all names in the full array (for example, I can only access array[0]) typesc ...

A guide to displaying previous and next data on hover in Angular 2

I have developed a basic Angular 2 application and everything is functioning correctly. In the Project Detail section, the next and previous buttons work fine - clicking them displays the respective data on the view. However, I am facing an issue where hov ...

Tips for navigating to a specific component within a single page

I'm facing an issue with scrolling to a specific component on the same page when a navbar item is clicked. Each component has a min-height of 100vh and there is a navbar at the top. I attempted using ViewPortScroller in the main component, but it does ...

Differentiating between Chrome and Safari user-agent strings using CSS only (without JavaScript)

Are there specific CSS selectors that can target Safari and Chrome exclusively? When attempting to target only Safari, I initially tried the following selector, but it seems to also target Chrome: html[data-useragent*="Safari"] { [...] } ...

Unable to include services within Angular entry components such as Modals

I am currently developing an Angular application where I have implemented a material modal (entry component). I am looking to integrate my AuthService and ngrx store into this modal, however, whenever I try to open the modal, I encounter the following erro ...

What is the best way to align a circular image using CSS?

Having an issue with positioning a rounded image to the left of a webpage. Despite trying various methods, the image ends up flat with its corners missing and positioned on the right side instead of the intended left. I've scoured the internet for ans ...

Before the user closes the window, Angular 2 makes an HTTP request

Whenever the user is about to close the window, I want to ensure that changes are saved. However, I'm facing an issue where the changes are not saved when I close the tab, even though it works fine when I refresh the page with F5. Below is the canDeac ...

Tips for lining up two images and text on the same row

I am facing a simple issue - how can I align an image and text in one line like this [image - text - image] and repeat the pattern. <html> <head> <title></title> <style> img { width: 100px; h ...

What are the reasons for not utilizing JSS to load Roboto font in material-ui library?

Why does Material-UI rely on the "typeface-roboto" CSS module to load the Roboto font, even though they typically use JSS for styling components? Does this mix of JSS and CSS contradict their usual approach? ...

Different option for positioning elements in CSS besides using the float

I am currently working on developing a new application that involves serializing the topbar and sidebar and surrounding them with a form tag, while displaying the sidebar and results side by side. My initial attempt involved using flex layout, but I have ...

Difficulty being faced in recognizing anchor tags through CSS selector methods by Mechanize

(Just wanted to check here since I didn't get much response on RailsForum lately.) Has anyone encountered issues with Mechanize not picking up anchor tags using CSS selectors? Here's a snippet of the HTML code: <td class='calendarCell& ...

Unable to retrieve file on Linux system through PHP

<?php // Ensuring that an ID is provided include('include/function.php'); if(isset($_GET['id'])) { // Retrieving the ID $id = intval($_GET['id']); // Validating the ID if($id <= 0) { die('Th ...

tips on rotating an image using nativescript

I'm attempting to insert a picture from my device and then adjust its orientation in nativescript. So far, I've been using imageSource to import the picture, but I'm unsure how to rotate it. If anyone has suggestions for another class that c ...