css - Normalize.css 不起作用 Angular 4/5

标签 css angular sass normalize

我是 Angular 和 SCSS 的新手。我想摆脱内置的浏览器样式,因此我安装了 normalize.css 并将其添加到我的 angular-cli.json 文件中。

 "styles": [
    "../node_modules/bootstrap/dist/css/bootstrap.min.css",
    "../node_modules/normalize.css/normalize.css",
    "assets/scss/main.scss"
  ],

我有一个组件并添加了 <p>TEST</p>元素,当我在浏览器上检查它时,<p>元素具有以下样式。

p {
  margin: 0 0 10px;
}

它有一个margin-bottom10px 。我预计这不应该有任何余量。我不知道我在这里做错了什么?我还需要导入其他东西吗?

最佳答案

标准化 CSS 不会将默认值重置为 0,但是:

Normalize.css makes browsers render all elements more consistently and in line with modern standards. It precisely targets only the styles that need normalizing.

您可能也从 boostrap 获得了这些值。

如果您想重置所有默认样式,您可以使用重置 CSS。

建议在浏览器中使用代码检查器(Chrome 开发者工具或 Firebug)来检查样式的来源。

关于css - Normalize.css 不起作用 Angular 4/5,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50421446/

相关文章:

html - 如何将 "align-vertical"facebook 按钮居中?

angular - 使用 Angular 4 和 Angular CLI 运行 Visual Studio 2017

css - 如何使用 Compass 从多个文件夹生成一个 Sprite ?

javascript - angularjs 2 rc4 变化检测 : expression changed after it was checked

jquery - 错误 : Property 'draggable' does not exist on type 'JQuery<HTMLElement>'

html - 使用 :after element - Animate out when mouse is out of button dimensions 对按钮的悬停效果

css - 更改 bootstrap.scss 文件

javascript - 简单的 css 在 Iceweasel 31.2 中不起作用

css - 使 DIV 表现得像表格

css - 无法使图像适合容器