-- 作者:yuji1998
-- 发布时间:5/17/2004 1:14:00 PM
-- [020210]我的XML學習二[CSS+XML]專題---小鞋子
1..........CSS定議節點的方法:小鞋.xml ---------------------------------------------------------------- <?xml version="1.0"?> <?xml-stylesheet type="text/css" href="1.css"?>這裏如果你連接不同的樣式表請修改. <books> <book> <author>lisongtao</author> <name>the application of ASP</name> </book> </books> --------------------------------------------------------- 1.css 顯示結果:BOOK節點的字的樣式,背景浅蓝色 ----------------------------------------------------------- books { display:block; } book { display:block; background-color:#aabbcc } --------------------------------------------- 心得:以上的定义方法和重定义HTML的标签样式一样,如对CSS不熟者,推荐用DW生成后再对应一下效果.很易就可以学会的. 样式类的定义XML显示方法. 小鞋.xml --------------------------------------------------------- <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/css" href="3.css"?> <list class="listclass"> <sublist class="listsmall">lisongtao</sublist> <sublist>zhongguo</sublist> </list> ---------------------------------------------------------- 3.css .listclass {color: red; font-size:26pt} .listsmall {color:blue; font-size:15pt} 类的ID引用样式方法. 小鞋.xml ------------------------------------ <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/css" href="ID.css"?> <school> <class id="list">lisongtao</class> <monitor id="list1">lisongtao</monitor> </school> --------------------------------- ID.CSS -------------------------------------------------- #list {font-size:28pt; color:red; display: block} #list1 {font-size:14pt; color:blue display: block } 在XML中直接使用CSS的方法 <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/css" href="sevil.txt"?><!--这句一定要有,而SEVIL.TXT可以换别的名字,不过中文好像这里不行.--> <FOO STYLE="font-weight: bold;color:red"> Hello XML! </FOO> 在一个样式表中合并引用另一个样式表的方法 @import url("sevil.css"); 用CSS定制个节点的块状显示 XML.XML -------------------------------------------------------------------------------- <?xml version="1.0" encoding="gb2312"?> <?xml-stylesheet type="text/css" href="CSS.css"?> <books xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"> <HTML:style> books { display:block; width:30em; } </HTML:style> <book> <author>list </author> <name> ASP及其应用</name> <publisher>Tsinghua University</publisher> <price>12.30</price> </book> <book> <author>James </author> <name> XML及其应用</name> <publisher>Tsinghua University</publisher> <price>15.30</price> </book> <book> <author>John </author> <name> CSS及其应用</name> <publisher>Peiking University</publisher> <price>16.30</price> </book> </books> --------------------------------------------------------------- CSS.CSS --------------------------------------------------------------- book { display:block; background-color:#AABBCC; padding:1.2em; margin-bottom:1em; } author { display:block; font-size:16pt; color:red; } 在同一个XML文件内引用多个CSS样式表的方法 <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/css" href="1.css"?> <?xml-stylesheet type="text/css" href="2.css"?>
|