如何删除css中的element.style
我正在使用 Joomla 1.5。 我有一个页面,其中已为标题添加了 CSS 位于
我对其进行了 firebug,看起来
element.style {
color:#666666;
}
我不知道它来自哪里..
但我正在将 css 应用于与其他标签相同的标签颜色。但它消失了。 如何全局删除 element.style..
I am using Joomla 1.5.
i am having a page where a cSS has been added for the title
which is in <strong></strong>
I firebug it , it appears as
element.style {
color:#666666;
}
i dont know of from where it comes from..
but i am having a css applied for the same tag with other color. but it disappeared.
How to remove the element.style globally..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
可以从外部样式表覆盖内联样式
这适用于大多数主要浏览器,Chrome、Safari、Firefox、IE8
它在 IE6 / IE7 中不起作用(据我所知)
希望这会有所帮助。
It is possible to override inline styles from an external stylesheet
This works in most major browsers, Chrome, Safari, Firefox, IE8
It doesn't work (to my knowledge) in IE6 / IE7
Hope this helps.
此代码来自 HTML,而不是来自 CSS。
该 HTML 会生成您的 element.style:Element.style
,顾名思义,它是在元素上定义的样式,并且无法覆盖它。如果您不想在该元素中使用该颜色,则必须在 html 上删除/更改它。
This code comes from HTML and not from your CSS.
This HTML with generate your element.style:
Element.style, as the name says, its the style defined on element and there is no way to override it. If you do not want that color in that element you must remove/change it on html.
似乎并不总是在 HTML 中设置。在我的例子中,element.style 为空:
未在任何 css 中设置,未在任何 html 源中设置。
我不知道我还应该看哪里。
It seems it is not always set in HTML. In My case the element.style is empty:
It is not set in any css and it is not set in any html source.
I dont't know where else I should look.
内联样式是从 HTML 或(现在更常见的是)页面加载后应用样式的 javascript 生成的。
Jquery 通常是造成这种情况的罪魁祸首,它使用直接应用于覆盖样式表的元素的 css 来执行动画。
例如,您可以先显示然后隐藏一个 div,在元素上留下“display:none”,以覆盖其前面的任何自然级联 CSS。当您将 CSS 转换和媒体查询与 JavaScript 混合时,这种情况经常会出现。
检查您的 JavaScript 是否有应用样式的任何实例。
尝试在动画上使用回调函数来清除样式:
Inline styles are generated from HTML or (more often these days) javascript applying styles after the page had loaded.
Jquery is often a culprit of this, performing animations using css applied directly on the element that overrides your stylesheet.
For instance you may show, then hide a div, leaving a 'display:none' on the element that overrides any naturally cascading CSS that precedes it. This comes up often when you are mixing CSS transitions and media queries with javascript.
Check your JavaScript for any instances of applied styles.
Try using a callback function on the animation to clear styles: