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

Is it possible for dynamically created injectors in Angular2 (created through Injector.create(...)) to be destructed at any point

Looking for insights on the lifecycle of injectors created using the Injector.create method I experimented with creating a component using ViewContainerRef.createComponent(...) and supplying dynamically generated dependencies through a custom injector pas ...

Maintaining the relative position of an SVG while scaling within a div element

I am in the process of incorporating my custom SVG knob icons into an electron application using flexbox. The challenge lies in keeping them centered within the rectangle icon regardless of browser size, as shown here. Ideally, the icons should adjust thei ...

The bootstrap 4 modal is not displaying the button as expected

I am currently working on an Angular 4 project and I am trying to implement a pop-up using Bootstrap 4. <div> <span class="text-center" id="span1">{{title}}</span> <button type="button" class="btn primary-btn" data-toggle="modal" data ...

Angular version 2 and above pipe as well as material tooltip

Seeking recommendations... I have a model: [{value:n, user:userId}], where value can be 0,1,2, etc... Initially, the client was receiving an array with objects like {value: 0, user: A}, {value: 1, user: B}, {value: 0, user: C}. I wanted to consolidate t ...

Displaying JSON data in a table using Angular 4

Here is a JSON data example: { "0": { "open": 93.3, "high": 96, "low": 93.3, "close": 95.04, "volume": 358172, "score": "100", "symbol": "ZBRA", "company_name": "Zebra Technologies Corp.", "company_sector": "Industrial Goods" }, "1": { "open": 19.1396, "h ...

Applying flexbox to create a visually appealing design

Is there a way to achieve this layout using flexbox without relying on grid due to limited support in IE11? I want to be able to easily add or remove small divs without adding more containers. To see the desired layout, check out this image: Desired Layou ...

Javascript functions properly on Chrome, Opera, and Edge browsers, but unfortunately does not work on FireFox and IE 11

If you're interested, I have some code available on JS Fiddle that showcases my skills. var getJSON = function (url) { "use strict"; return new Promise(function(resolve, reject) { var xhr = new XMLHttpRequest(); xhr.open('get' ...

Applying box-shadow to tables and collapsing borders with border-collapse property in IE!

The box-shadow property does not function properly in Internet Explorer when the table has a border-collapse: collapse style applied to it. ...

What is the best way to make a block fill 100% of a container-fluid?

Here is a block: <div class="container-fluid"> <div class="content_wrapper"> </div> </div> What's the best way to display the .content_wrapper block with 100% content width and margins from the body borders? ...

The issue of duplicate CSS arising during the compilation of SASS into a single CSS file with G

Just getting started with Stack Overflow and Gulp (using version 3.9.1). My goal is to compile all of my scss files into a single css file for my website. Here's what I have in my gulpfile so far: var gulp = require('gulp'); var sass = requ ...

When you refresh the page, the number of items in the cart displayed on the navbar always shows 0

When using my angular application, I encountered a problem with adding movies to a cart. Although I can successfully add them to the cart and see the correct number of movies reflected in the navbar, upon refreshing the page, the count resets to 0. Here i ...

Combining left-aligned and centered elements within a grid using flexbox

Looking to create a fluid responsive grid layout using flexbox, without the need for media queries. The number of elements in the grid can vary and each item should have a fixed, equal width with left alignment. The entire group should have equal left and ...

Material-UI icons refusing to show up on the display

I've been working on creating a sidebar component and importing various icons to enhance the UI, but for some reason they are not displaying on the screen. I even tried other suggested solutions without success. <SidebarOption Icon = {InsertComment ...

How do I loop through each object within an observable that contains an array of objects in Angular 2?

Hey everyone! I'm currently in the process of upgrading my skills to Angular 2 and I have a few questions. One of them being, how can I iterate through each object in an observable array object? I was able to successfully retrieve data from "api/v1/e ...

Revealing non-div elements with the CSS hover attribute

I'm looking for a way to utilize the CSS hover property on individual elements within a div in order to affect specific span elements. For example, hovering over "something1" should reveal "text1" and so forth. Is there a way to achieve this without ...

Click on a div to switch between displaying an arrow pointing to the right and an arrow

Currently working on a design for an accordion-style layout and looking to implement toggling arrow icons when the div is clicked. I have managed to toggle the content of the div successfully, but now seeking assistance in achieving the same functionality ...

Showing information in a tree structure using HTML, CSS, and JQuery

Trying to figure out how to present a large amount of data in a tree structure. Each node could have multiple children and parents, requiring a dynamic representation. I've explored various JavaScript libraries like D3 and Raphael, but unfortunately, ...

Employing the ngFor directive, insert two elements onto a single row, then proceed to generate a fresh

For some time now, I've been attempting to loop through an array of objects using *ngFor and place two elements inside each row. The goal is to generate a new row after every two components have been added. Here's what I've attempted so far ...

When the frontend-maven-plugin executes the npm run build command, it encounters difficulty locating the package.json file

I am currently developing an application with a Spring Boot backend and an Angular frontend. To build the frontend, I am utilizing the frontend-maven-plugin in conjunction with Maven. However, when running "mvn spring-boot:run" command, an error is encount ...

Working with base URL and relative paths in Angular 2 on GitHub Pages

While attempting to deploy my project site on gh-pages, I encountered an issue with relative paths in the templates of my Angular2 app that uses webpack. Despite setting the base URL to match my repository name, everything loads fine except for the paths w ...