Following is the example of using CSS in XML document
This is an CSS file
xsmp
{
width:3in;
height:2in;
clear:none;
overflow:scroll;
font:14pt 'Century Gothic',serif;
color:blue;
margin:0.5in;
padding:0.25in;
border:solid blue;
display:block;
}
greeting
{
display:block;
font-family: Century Gothic, Book Antiqua; font-size: 26pt;
width: 30em;
color:red;
}
question
{
display:block;
font-size:x-large;
color:brown;
}
answer.ans
{
display:block;
font-size: 16pt;
color:green;
}
The following is the XML file with Style sheet link with it
<?xml version='1.0'?>
<?xml-stylesheet type="text/css" href="hello.css"?> //hello.css is the name of css file
<xsmp>
<greeting> Hello <extension> there ! </extension> </greeting>
<answer class = "ans">
<extension> Good Morning! </extension>
<question> How are you? </question>
</answer>
</xsmp>
The above picture shows the result on the browser
