且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RSS提要显示

更新时间:2023-11-27 19:20:04

您可以使用XSLT和CSS。



如果您不关心工作链接等,那么只需使用CSS。



例如,以下是我如何在我的某个网站上设置RSS订阅源的样式:


rss {font- family:Arial,Helvetica,sans-serif;}

channel title {display:block;填充:1em的;颜色:#FFF; border-bottom:1px纯黑色;字体重量:粗体;字体大小:140%; background-color:#4483C7;}

channel description {display:block;向左飘浮;字体大小:130%; margin:1em;}

channel item {border:1px solid#4483c7; clear:both;显示:块;填充:0.5em; margin:1em;}

频道项目标题{background-color:#4483c7;边界底部宽度:0;颜色:#FFF;显示:块;字体大小:110%;字体重量:粗体;余量:0; padding:0.2em;}

频道项目描述{display:block;浮动:无;余量:0; text-align:left;填充:0.2em 0.5em 0.4em;颜色:黑色;字体大小:100%; font-weight:normal;}

频道项链接{color:#666;显示:块;字体大小:86%; padding:0 0.5em;}

结果如下: http://www.ourladyofgrace.com/Bulletins/olg_bulletins.xml



如果你想使页面工作,那么使用XSLT。



这里有一些信息。 http://www.paulwest.co.uk /article.php/styling-rss-news-feeds-with-xslt


I have created a news RSS feed for my website but want to display is in a format similar to http://www.apple.com/hotnews/ How would I put code onto my HTML page which would take the items from my RSS?

You could use XSLT and CSS.

If you didn't care about links working, etc., then just use CSS.

For instance, here is how I style one of the RSS feeds on one of my sites:

channel link, channel language, channel copyright, channel managingEditor, channel webMaster, channel docs, channel lastBuildDate, channel item pubDate {display:none;}

rss {font-family:Arial, Helvetica, sans-serif;}

channel title {display:block; padding:1em; color:#FFF; border-bottom:1px solid black; font-weight:bold;font-size:140%; background-color:#4483C7;}

channel description {display:block; float:left; font-size:130%; margin:1em;}

channel item {border:1px solid #4483c7;clear:both; display:block; padding:0.5em; margin:1em;}

channel item title {background-color:#4483c7; border-bottom-width:0; color:#FFF; display:block; font-size:110%; font-weight:bold; margin:0; padding:0.2em;}

channel item description {display: block; float:none; margin:0; text-align: left; padding:0.2em 0.5em 0.4em; color: black; font-size:100%; font-weight:normal;}

channel item link {color:#666; display:block; font-size:86%; padding:0 0.5em;}

The result is this: http://www.ourladyofgrace.com/Bulletins/olg_bulletins.xml

If you want to make the page "work", then use XSLT.

Here's some info. http://www.paulwest.co.uk/article.php/styling-rss-news-feeds-with-xslt