HTML and CSS Reference
In-Depth Information
Doing so, elements can be used from these namespaces in the channel as shown in Listing 8-27 or in item
elements such as in the example in Listing 8-28.
Listing 8-27. Elements from External Namespaces in an RSS Channel
<dc:creator> Dr. Leslie Sikos </dc:creator>
<sy:updatePeriod> daily </sy:updatePeriod>
<sy:updateFrequency> 1 </sy:updateFrequency>
<sy:updateBase> 2011-01-01T12:00+00:00 </sy:updateBase>
<atom:link href=" http://www.lesliesikos.com/sikos.xml " rel="self"
type="application/rss+xml" />
Listing 8-28. An Element from an External Namespace in an RSS Item
<content:encoded> <![CDATA[ An escaped RSS item can contain markup elements such as
<a href="http://www.example.com/">hyperlinks</a> that work in all major news feed
readers. ]]> </content:encoded>
Styling RSS Feeds
The browsers that support news feeds usually provide a basic styling or no styling at all (rendering a tree structure
instead). Developers who are not satisfied with that or want to ensure an advanced look (which is also similar in all
browsers) can format RSS channels using CSS or XSLT.
In the first case, a CSS reference is required in the form presented in Listing 8-29.
Listing 8-29. Using a CSS File for Styling RSS
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/css" href="css/feed.css" ?>
<rss version="2.0">
Writing the CSS rules is straightforward. For example, the font size of the main title can be increased by the CSS
rule presented in Listing 8-30.
Listing 8-30. Setting the Font Size for the RSS Channel and Title
channel title {
font-size: 1.4em;
}
The font of the document can be set as shown in Listing 8-31.
Listing 8-31. A CSS Rule for the Entire RSS Document
rss {
font-family: Verdana, Helvetica, sans-serif;
}
 
Search WWH ::




Custom Search