Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I apply my CSS stylesheet to an RSS feed

Tags:

css

rss

blogs

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?

like image 558
Kip Avatar asked Sep 23 '08 01:09

Kip


People also ask

How do I style an RSS feed?

Applying CSS to your RSS xml-stylesheet type="text/css" href="rss. css"?> This line of code can be inserted just under the XML version declaration and the CSS will be applied to your document. You can design the display of your style sheet in any way you please, using the XML tags provided in your feed.

What is RSS and CSS?

It is an XML representation of a web site. It is basically XML data. An RSS feed is a standardized method of data distribution. Its main purpose is to publish works that are updated often like blogs or news articles.

How do I display an RSS feed in HTML?

How To Display RSS Feed In HTML Website? Step 1: Select HTML as your website platform from the options. Step 2: Set the width and height (or auto) of your feed and click on “Get Code”. Step 3: Copy the given Code and paste it into the back-end of any webpage where you want to display RSS feed.


1 Answers

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

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.

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.

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.

like image 185
Joel Spolsky Avatar answered Sep 22 '22 15:09

Joel Spolsky