<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
标签 javascript jquery html css
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 7 年前。
在我的站点中,我正在使用 Jquery/Javascript 更改 DIV 的样式。同样的DIV样式,后来被第三方js库改了。有没有办法避免第三方样式更改。 我不允许使用 CSS 覆盖,因为 CSS 也是由不同来源编写的。
最佳答案
// your css
//// here use id and !important(hack)
#id1{
color: blue !important;
}
// third party css class
.class1{
color: red;
}
// your element
<input type="text" class="class1" id="id1"/>
输出: 颜色将为蓝色。你的CSS会赢。
阅读更多关于 CSS 的特殊性以更好地理解。
注意:Id 比 class 更具体。
关于javascript - 如何避免第三方CSS影响现有CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32350526/
相关文章:
javascript - react : how to change page when using react-navigation and react-router?
Jquery 插件 filthypillow。如何将时间格式设置为 24 小时制
html - 什么会导致 bootstrap 列表现得像行?
javascript - setInterval 和 jquery
javascript - Raphaël 的响应式 SVG 折线图
html - 如何使用 CSS 更改 iframe 页面而不更改父页面和外部链接