重写文件之间的css属性
我有两个CSS文件重写文件之间的css属性,css,Css,我有两个CSS文件test1.CSS和test2.CSS,如下所示: test1.css body { background: blue; } body { font-weight: bold; } test2.css body { background: blue; } body { font-weight: bold; } 我在我的test.html中导入了两个CSS文件,使用: <link type="text/css" rel="stylesheet" href
test1.CSS
和test2.CSS
,如下所示:
test1.css
body {
background: blue;
}
body {
font-weight: bold;
}
test2.css
body {
background: blue;
}
body {
font-weight: bold;
}
我在我的test.html
中导入了两个CSS文件,使用:
<link type="text/css" rel="stylesheet" href=“test1.css" />
<link type="text/css" rel="stylesheet" href=“test2.css" />
我不想在我的
正文
中应用背景
&其他CSS属性,我只想应用字体重量
。在test2.CSS文件中,您可以使用正文
上的all:initial
放弃所有CSS,除了unicode bidi和方向,来自test1.css forbody
body {
all: initial;
font-weight: bold;
}
阅读:
CSS all shorthand属性将除unicode bidi和direction之外的所有属性重置为其初始值或继承值
要么删除第一个样式表的链接,要么在第二个样式表中为body定义一个背景。我认为你应该为此添加类,而不是调用不同的css。如果你关心IE,除了最新的safari,你需要一种不同的方法:我也需要IE,请告诉我我应该做些什么来支持IE@user123尝试
all:inherit
@rahuldesai,正如JonP所说,“all”属性不支持IE,所以我相信all:inherit也不支持IE