html - 使用 css 定位与其他东西具有相同类的东西
问题描述
我想定位一个似乎与另一个按钮具有相同类的按钮。当我无法更改 html 时,有没有办法使用 css 进行区分?
在此页面上,提交按钮已消失,但我认为这是因为我在这里隐藏了一个共享同一类的按钮
html:
<button type="submit" class="btn button ur-submit-
button">
<span></span>Submit</button>
解决方案
我可以看到.btn
具有以下属性的通用类:
.btn.btn {
color: transparent! important;
background: transparent! important;
border: none! important;
}
.ur-submit-button
尝试通过添加以下 CSS 来添加您的类选择器,以覆盖您的类的隐藏属性:
button.btn.button.ur-submit-button {
color: initial !important;
/* background: initial !important; */
/* border: initial !important; */
}
它将显示按钮,然后您可以使用相同的选择器进一步修改其外观。
虽然使用 of!important
不是一个好习惯,但它似乎已经被插件使用。