Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to style RSS/ATOM feeds?

Tags:

css

rss

atom-feed

One thing I've noticed is that my blog posts show up very different in my RSS feed than on my actual blog. Presumably, this is because CSS doesn't apply to RSS feeds, so layout is messed up.

For example, if in my feed I have something like this:

<div class="right-floater">Some right-float text!</div>
<p>Normal paragraph text.</p>

...on the blog, it will display properly. In the actual RSS feed, it will be laid out sans CSS and the <div> will be to the left of the <p>, presumably.

Is there a way to add in a link to CSS stylesheet information to have reader applications load the styles so that things style properly when viewed in an application like Google Reader?

like image 418
Naftuli Kay Avatar asked Nov 20 '25 01:11

Naftuli Kay


1 Answers

It depends on the feed reader, but yes, most will ignore CSS entirely. Some (like Google Reader) will pay attention to the style attribute if it's "simple" enough, so you could write:

<div style="float: right">Some right-float text!</div>
<p>Normal paragraph text.</p>

For security reasons (primarily XSS avoidance), CSS has to pass through a filter. Only "known safe" CSS is allowed through.

like image 147
Laurence Gonsalves Avatar answered Nov 22 '25 18:11

Laurence Gonsalves