覆盖文件之间的css属性

时间:2017-01-23 03:37:05

标签: css

我有两个CSS文件import $ from 'jquery'; window.jQuery = $; global.jQuery = require('jquery'); import "bootstrap"; import DataTable from 'bootstrap'; global.DataTable = DataTable; import "datatables.net"; import "datatables.net-buttons"; import "datatables.net-select"; import "bootstrap/js/dropdown"; import "bootstrap-select"; test1.css,如下所示:

test1.css

test2.css

test2.css

body {
  background: blue;
}

我使用以下内容导入了body { font-weight: bold; } 中的两个CSS文件:

test.html

我不想要<link type="text/css" rel="stylesheet" href=“test1.css" /> <link type="text/css" rel="stylesheet" href=“test2.css" /> &amp;要在我的background中应用的其他CSS属性,我只想要应用body

1 个答案:

答案 0 :(得分:1)

在您的test2.css文件中,您可以使用all:initial上的body来放弃除了unicode-bidi和方向之外的所有CSS,来自test1.css的body。< / p>

body {
  all: initial;
  font-weight: bold;
}

阅读:all - CSS | MDN

  

CSS all handhand属性将除了unicode-bidi和direction之外的所有属性重置为其初始值或继承值。