如何在CSS中用初始类覆盖覆盖?

如何在CSS中用初始类覆盖覆盖?,css,Css,我不能编辑CSS。我只能做一个覆盖 我有边界: input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="url"], input[type="tel"], input[type="number"], input[type="date"], input[type="month"], input[type="week"], input[type="tim

我不能编辑CSS。我只能做一个覆盖

我有边界:

input[type="text"], input[type="password"], input[type="email"], 
input[type="search"], input[type="url"], input[type="tel"], 
input[type="number"], input[type="date"], input[type="month"], 
input[type="week"], input[type="time"], input[type="range"], 
input[type="color"], select, textarea {
    border: 1px solid #e8e8e8
}
然后它有一个覆盖(我无法编辑):

我想取消覆盖并返回到第一段代码。这样做的最佳实践是什么


@编辑我想使它依赖于初始类。因此,如果它的边框更改为
2px纯红
,则
。部分表单
也可以输入。

您可以添加
!重要信息
显示在选择器的末尾,如下所示

input[type="text"], input[type="password"], input[type="email"], 
input[type="search"], input[type="url"], input[type="tel"], 
input[type="number"], input[type="date"], input[type="month"], 
input[type="week"], input[type="time"], input[type="range"], 
input[type="color"], select, textarea {
    border: 1px solid #e8e8e8 !important;
}

然而,很多人认为经常这样做是不好的做法。我会问你为什么不能编辑更具体的选择器,因为可能有一个很好的理由不应该更改它。

你应该使选择器的值大于你想要覆盖的规则。但无论如何都要避免使用
!重要信息
。您还应该能够创建一个与要覆盖的选择器相同的选择器,并在它之后加载它,这将覆盖它。@j08691抱歉,忘记了选择器。我加了“.section\u form”你不能这么做。当然不是第二部分,至少是这样。为什么不能编辑覆盖属性的其他选择器?这听起来像是一个本地化的问题,应该由一个人来解决,而不是通过编程来解决。
input[type="text"], input[type="password"], input[type="email"], 
input[type="search"], input[type="url"], input[type="tel"], 
input[type="number"], input[type="date"], input[type="month"], 
input[type="week"], input[type="time"], input[type="range"], 
input[type="color"], select, textarea {
    border: 1px solid #e8e8e8 !important;
}