html - 如何删除 Angular 应用程序主体末端之间的奇怪空间?

标签 html css angular

在我的 Angular 应用下是一个奇怪的空间。 Space 是 body 标签的一部分,但它不是 app-root 标签的一部分。我怎样才能删除这个空间?

enter image description here

/*styles.css*/
@import './styles/themes.scss';

@include mat-core();
@include angular-material-theme($material-light-theme);

.dark-theme{
    @include angular-material-color($material-dark-theme);
}

html, body { height: 100%; }
body { margin: 0; font-family: Verdana, Roboto, "Helvetica Neue", sans-serif; }

我已经在我的 App-Component 上试过了,但没有效果。

app-component.css
:host {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
}

/*app-component.scss*/
bg-intranet-header {
    z-index: 2;
    position: sticky;
    top: 0;
}

我在两个浏览器(firefox、edge)中测试过它。这是实际解释的 css 的 3 个屏幕截图。 enter image description here

enter image description here

enter image description here

最佳答案

在 styles.css(或 styles.scss,..)中,你放置:

body {
  margin: 0;
}

这必须在那个特定的文件中。 如果它不起作用,请尝试:

body {
  margin: 0 !important;
}

关于html - 如何删除 Angular 应用程序主体末端之间的奇怪空间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64314860/

相关文章:

javascript - 侧边导航不适用于移动 View

jquery - 如何在单击文档正文和指定元素时淡入和淡出任何元素?

html - 漂浮一点

javascript - 在同一 Canvas 中顺时针旋转一个轮子,逆时针旋转另一个轮子

html - 动态显示 "show more"

html - 显示白色文本的 wordpress 小部件,无法将其更改为黑色?

c# - 如何在 ASP.NET Core Angular 应用程序中使用 SignalR Stream?

angular - 使用 mat paginator 方法 firstPage() 进行功能单元测试

javascript - Spring-jsp页面中未加载css和图像文件

javascript - 后端和前端之间模型的反序列化和序列化模型(Angular 6)