如何删除css中的element.style

发布于 2024-08-28 12:24:03 字数 249 浏览 3 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

寄居者 2024-09-04 12:24:03

可以从外部样式表覆盖内联样式

strong[style] { color: blue !important; } 

这适用于大多数主要浏览器,Chrome、Safari、Firefox、IE8

它在 IE6 / IE7 中不起作用(据我所知)

希望这会有所帮助。

It is possible to override inline styles from an external stylesheet

strong[style] { color: blue !important; } 

This works in most major browsers, Chrome, Safari, Firefox, IE8

It doesn't work (to my knowledge) in IE6 / IE7

Hope this helps.

那一片橙海, 2024-09-04 12:24:03

此代码来自 HTML,而不是来自 CSS。

该 HTML 会生成您的 element.style:Element.style

<strong style="color:#666666;">Just text</strong>

,顾名思义,它是在元素上定义的样式,并且无法覆盖它。如果您不想在该元素中使用该颜色,则必须在 html 上删除/更改它。

This code comes from HTML and not from your CSS.

This HTML with generate your element.style:

<strong style="color:#666666;">Just text</strong>

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.

我为君王 2024-09-04 12:24:03

似乎并不总是在 HTML 中设置。在我的例子中,element.style 为空:

element.style {
}

在任何 css 中设置,在任何 html 源中设置。
我不知道我还应该看哪里。

It seems it is not always set in HTML. In My case the element.style is empty:

element.style {
}

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.

醉生梦死 2024-09-04 12:24:03

内联样式是从 HTML 或(现在更常见的是)页面加载后应用样式的 javascript 生成的。

Jquery 通常是造成这种情况的罪魁祸首,它使用直接应用于覆盖样式表的元素的 css 来执行动画。

例如,您可以先显示然后隐藏一个 div,在元素上留下“display:none”,以覆盖其前面的任何自然级联 CSS。当您将 CSS 转换和媒体查询与 JavaScript 混合时,这种情况经常会出现。

检查您的 JavaScript 是否有应用样式的任何实例。

尝试在动画上使用回调函数来清除样式:

$(this).css( "display", "" );

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:

$(this).css( "display", "" );
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文