简体   繁体   English

更改链接的CSS文件以删除特定HTML标记的样式

[英]Alter linked CSS file to remove styling for a specific HTML tag

I've got a CSS file which provides some styles, but one of them really sucks (the <code> tag styling). 我有一个CSS文件提供了一些样式,但其中一个真的很糟糕( <code>标签样式)。 I'd like to eliminate it, possibly through JavaScript. 我想通过JavaScript消除它。 Is there a quick way to do this? 有快速的方法吗?

Edit: These elements don't need styling, and I don't need to replace the existing styling, I just need to get rid of it. 编辑:这些元素不需要样式,我不需要替换现有的样式,我只需要摆脱它。

You can make a more specific CSS declaration for <code> . 您可以为<code>创建更具体的 CSS声明。 Mileage may vary, depending on your mark-up. 里程可能会有所不同,具体取决于您的加价。

body code {
 ... your styling ...
}

See: http://coding.smashingmagazine.com/2010/04/07/css-specificity-and-inheritance/ 请参阅: http//coding.smashingmagazine.com/2010/04/07/css-specificity-and-inheritance/

I ended up just altering the stylesheet and hosting a copy. 我最终只是改变了样式表并托管了一份副本。 Not ideal, but functional. 不理想,但功能齐全。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM