如何将我的CSS样式表应用于RSS源 [英] How can I apply my CSS stylesheet to an RSS feed

查看:223
本文介绍了如何将我的CSS样式表应用于RSS源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的博客上,我使用了一些在我的样式表中定义的CSS类,但在RSS阅读器中,这些样式不会显示。我一直在寻找 class =whatever并替换为 style =something:something;。但是这意味着每当我修改我的CSS,我需要修改我的RSS生成代码,它不适用于属于多个类的标签(即 class =snapshot accent)。有没有办法从我的feed指向我的样式表?

On my blog I use some CSS classes which are defined in my stylesheet, but in RSS readers those styles don't show up. I had been searching for class="whatever" and replacing with style="something: something;". But this means whenever I modify my CSS I need to modify my RSS-generating code too, and it doesn't work for a tag which belongs to multiple classes (i.e. class="snapshot accent"). Is there any way to point to my stylesheet from my feed?

推荐答案

流行的RSS阅读器不会打扰下载样式表,即使您提供了一个并使用<?xml-stylesheet?> 链接到它。

The popular RSS readers WILL NOT bother downloading a style sheet, even if you provide one and link to it using <?xml-stylesheet?>.

读者只需从标签中剥离所有inline style 属性。从今天的测试,我发现Outlook 2007似乎剥离了所有的样式,例如,即使它们是内联的。

Many RSS readers simply strip all inline style attributes from your tags. From testing today, I discovered that Outlook 2007 seems to strip out all styles, for example, even if they are inline.

好的RSS阅读器允许有限的内联 style 属性。例如,请参阅本文在Bloglines 了解哪些CSS不会被删除。从实验来看,Google阅读器似乎通过某些风格没有受到伤害。

Good RSS readers allow a limited set of inline style attributes. See, for example, this article at Bloglines about what CSS they won't strip. From experimentation, Google Reader seems to pass through certain styles unharmed.

RSS的哲学是读者负责演示。许多人认为RSS应该是纯文本,RSS feed中的CSS是不合适的。在RSS提要上强加一个不同的字体可能不合适。但是,某些类型的内容(例如,浮动在左侧的图片,小心放置字幕)需要最小量的样式才能保持其语义。

The philosophy of RSS is indeed that the reader is responsible for presentation. Many people think that RSS should be plain text and that CSS in RSS feeds is inappropriate. It's probably not appropriate to impose a different font on your RSS feeds. However, certain types of content (for example, images floated on the left, with captions positioned carefully) require a minimal amount of styling in order to maintain their semantic meaning.

这篇关于如何将我的CSS样式表应用于RSS源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆