Tips for eliminating white frames or borders on the Mapbox canvas map

In my current project using Angular 10, I have integrated Mapbox to display path routes. Following the standard Angular practice of splitting components, I separated the map rendering component and called it into the main map component. However, I encountered an issue with white borders or frames appearing at the top and bottom inside any container where I placed the map.

new-map.component.ts

<details>
  <summary class="bg-light text-dark">
    <nav class="navbar navbar-light
                bg-light fs-3 justify-content-end"
                (click)="changeMapArrow()">
      <span class="material-icons">
        <b>{{arrowClass}}</b>
      </span>
    </nav>
  </summary>
  <app-mini-map></app-mini-map>
</details>

mini-map.component.ts

<div class="row d-flex flex-column">
  <div class="col-12">
    <div class="row">

      <div class="col-6 ml-0">
        <b>Needs to know:</b>
        <span class="text-primary ml-3">
          <b>4
            <span class="material-icons check-icon-position mr-1">
              check_circle_outline
            </span>
          </b>
        </span>
        |
        <span class="text-danger ml-2">
          <b>2 ETA Delay</b>
        </span>

      </div>

      <div class="col-6 d-flex flex-row justify-content-end align-items-start">

        <p class="text-muted">Style map:</p>

        <input type="radio" class="btn-check ml-3" name="options" id="option1" autocomplete="off" checked>
        <label class="btn btn-light ml-3 btn-style-position text-muted"
                for="option1" (click)="setMapStyle('gray', 'to_gray')">
                <b>Gray</b>
        </label>

        <input type="radio" class="btn-check ml-3" name="options" id="option2" autocomplete="off">
        <label class="btn btn-light ml-3 btn-style-position text-muted"
                for="option2" (click)="setMapStyle('dark', 'to_dark')">
                <b>Dark</b>
        </label>

        <input type="radio" class="btn-check" name="options" id="option4" autocomplete="off">
        <label class="btn btn-light ml-3 btn-style-position text-muted"
                for="option4" (click)="setMapStyle('color', 'to_color')">
                <b>Color</b>
        </label>
      </div>

    </div>
  </div>

  <div id="map-container" class="col-12">
    <div #miniMapa class="border-rnd-map mini-mapa-test"></div>
    <ul class="list-group" [style.display]="!cardinalPointsMenu ? 'none' : 'block'" >
      <ng-container *ngFor="let point of pointsToFitBound">
        <li class="list-group-item"
            (click)="moveToFitArea(point.fitPoint)"
            *ngIf="point.ableToShow">
          {{point.cardinalPoint}}
        </li>
      </ng-container>
    </ul>
  </div>
</div>

styles applied over the mini-map.component.sass

#map-container
  width: 100%
  height: 200px
  margin: 0 auto

.mini-mapa-test
  width: 100%
  height: 500px
  margin: 0 auto

https://i.stack.imgur.com/hGcEe.png https://i.stack.imgur.com/JxvL2.png

I have experimented with various HTML element containers other than a div, but the same error persists. Interestingly, the errors do not occur when I use a single div in the parent component, which is the only configuration that works properly.

Answer №1

It's effective for my needs

<div id="map"></div>

#location {
    position: fixed;
    top: 0; bottom: 0;
    left: 0; right: 0;
}

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

Utilizing jQuery for displaying or hiding list elements

To view all the code, click on this link: http://jsfiddle.net/yrgK8/ A section titled "news" is included in the code snippet below: <ul id="news"> <li><p>asfdsadfdsafdsafdsafdsafdsafdsafdsa</p></li> <li>&l ...

Automatic Addition of Row Numbers Enabled

I'm currently exploring coding and experimenting with creating a scorekeeper for family games. I've managed to add rows dynamically and automatically sum up the entered information in the "total" row at the bottom. However, I'm facing an iss ...

What's preventing the buttons from shifting positions?

Having some trouble with my Minesweeper Web Game setup. My buttons are stuck in place and won't budge. Can someone help me figure out what's wrong? Here's the code snippet I've been working on (FYI, using NetBeans 8.1 IDE) HTML: <! ...

What is the best way to make a DIV box span the entire webpage without overflowing to the left?

I am currently working on a client's website and running into some issues with the layout of the booking page. The address is supposed to be on the left side, the contact form on the right, and both should be contained within a white box that fills th ...

What is the best way to center a div horizontally on all screen resolutions using only CSS?

The margin: 0 auto declaration is not having the desired effect for some reason. I have attempted using text-align in the header, as well as exploring various other options, but none seem to be working. This is my current code: div.middle { font-fami ...

"Loop through an array using forEach leads to a subscription that

I am a beginner in Angular and struggling to understand how async functions work. I have written the following code, but I am encountering an error: GET https://localhost:44353/api/ecams/id/undefined 400 and ["The value 'undefined' is not va ...

Ways to conceal a text-filled div behind an image using 3D transformation

I've been working on creating three images with a fun 'flipcard' effect for the past day and a half, and I believe I'm getting closer to achieving my goal. However, there is one issue remaining, as you can see in the codepen. When the ...

Nested loop with Angular and Bootstrap Modal

I am trying to implement a Modal in Angular to display the details of a row in a table with matching IDs, but I'm encountering an issue where only the data from the first row is shown when I open the Modal. The other rows do not seem to work correctly ...

CSS Flexbox with 3 columns and a grid layout of 4 by 4, with one large item included

I am currently exploring how to implement this layout using Flexbox. So far, I have only managed to come up with the following code snippet: Is there a way to achieve this purely through CSS without altering the HTML structure, considering it is generated ...

My component fails to load using Angular Router even though the URL is correct

I have been experiencing an issue while trying to load my Angular component using the router. The component never appears on the screen and there are no error messages displayed. app-routing-module { path: '', redirectTo: '/home', ...

Incorporating Keyboard Features into Buttons

How can I toggle the page selectors in #pageList using a keyboard shortcut instead of clicking on the .togglePL button? I've tried looking up solutions online and asking questions here, but haven't found a working solution yet. Below is the code ...

How can I send a current variable through PHP?

I have a pressing deadline and I need some guidance before moving forward. Can someone please advise if what I'm attempting is feasible or if there's a quicker solution? I encountered some problems with an accordion menu, so as a temporary fix, ...

Retrieve the injectable value when importing SubModule into the App Module

Let me provide some background information... I have a feature module that requires a string value to be passed to its forRoot static method when imported in app.module.ts, like this: @NgModule({ declarations: [ /* ... */ ], imports: [ My ...

Tips for adjusting the color of a linear gradient in a shimmer effect

I have a puzzling question that I just can't seem to solve. My goal is to display a shimmer effect on cards as a temporary placeholder until the actual content loads. I found some CSS code in this answer, but when I tried it with a dark background, t ...

Submenu malfunctioning in Internet Explorer and Chrome, but functioning properly in Firefox and Opera

I've been working on some HTML code that runs perfectly in FF and Opera, and even in IE for my friend. However, I'm having trouble getting the output to display properly in Chrome. Any ideas why this might be happening? <html> <head> ...

Issue encountered: NullInjectorError - R3InjectorError has been caused by a problem within AppModule regarding InjectionToken HTTP_INTERCEPTORS linking to TransferState

Error Image:- Error Images I am encountering this error: ERROR NullInjectorError: R3InjectorError(AppModule)[InjectionToken HTTP_INTERCEPTORS -> [object Object] -> TransferState -> TransferState -> TransferState]: NullInjectorError: No provider ...

The metadata version discrepancy has been detected for the module located at C:/xampp/htdocs//node_modules/angular2-flash-messages/module/index.d.ts

While working with Angular 4, I encountered an error after trying to install angular2-flash-messages using npm with the following command: npm install angular2-flash-messages --save The error I encountered can be viewed in the following image: enter im ...

Include money symbols within input fields with padding and vertical alignment

I am looking to create an input field that includes either € or $ currency symbols. The challenge is ensuring perfect vertical centering inside the input, especially when using padding. Is there a foolproof method to achieve this? https://i.stack.imgur ...

List of items:1. The first item is elevated in its position

Can anyone explain why the first li item is displaying higher than the rest when I assign an id or class to the div element? Take a look at the code snippet below: <div id="pickList"> <ul *ngFor="let channel of currentPickSelection"> ...

Looking for a way to add shadow effects to mat-rows in Angular

Is it possible to bring box shadow while hovering in a table using CSS? I noticed that the bottom border seems to block the shadow from displaying, except for the last one. Has anyone tried using mat-elevation in this scenario, and if so, were you able to ...