首页 > 解决方案 > 如何在 component.html 中删除 Boostrap 默认正文样式

问题描述

我有一个带有我自己的 css 的角度小部件指令。当我在另一个应用程序组件中添加我的小部件时,它会被 Bootstrap 默认 css/styles 覆盖。

这是我的boostrap css 在此处输入图像描述

我的问题是如何在我试图覆盖的组件 .css 中删除字体系列但它不起作用?

    body {

line-height: 1.15; 
}

在此处输入图像描述

我也尝试了 !important 如下,但仍然应用引导样式

body {
  font-family: "Open Sans", sans-serif !important;
}

标签: htmlcssangularsassbootstrap-4

解决方案


在引导 CSS 之后插入您的 CSS。如果这不起作用用户 !important 覆盖您想要的样式。

例子:

body {
   font-family:none!important;
   line-height: 1.15!important;
}

推荐阅读