標籤:style blog http color io os 使用 ar 資料
實現效果
學號 姓名 班級 課程 教師
表格背景設為綠色,儲存格置中顯示
學號部分,藍色字型,16磅大小;
姓名部分紅色字型,帶有底線,12磅大小
班級課程名,教師,綠色字型,12磅大小
XML代碼:
1 <?xml version="1.0" encoding="UTF8"?> 2 <?xml-stylesheet type="text/css" href="student.css"?> 3 <students> 4 <student> 5 <sid>學號</sid> 6 <sname>姓名</sname> 7 <sclass>班級</sclass> 8 <scourse>課程</scourse> 9 <teacher>任課教師</teacher>10 </student>11 <student>12 <sid>1215115001</sid>13 <sname>果果</sname>14 <sclass>軟體設計</sclass>15 <scourse>資料結構</scourse>16 <teacher>王岷</teacher>17 </student>18 19 <student>20 <sid>1215115001</sid>21 <sname>明明</sname>22 <sclass>資料庫</sclass>23 <scourse>演算法分析</scourse>24 <teacher>王博</teacher>25 </student>26 <student>27 <sid>1215115001</sid>28 <sname>貝貝</sname>29 <sclass>遊戲開發</sclass>30 <scourse>資料庫編程</scourse>31 <teacher>陸路</teacher>32 </student>33 </students>
css代碼:
1 students 2 { 3 border:1px solid; 4 color: #33FF66; 5 width:500px; 6 height:170px; 7 text-align:center; 8 vertical-align: middle; 9 position:middle;10 }11 student12 {13 background-color:#33FF66;14 display:block;15 margin:5px 5px 5px 5px ;16 border:1px solid;//表格邊框17 width:500px;18 19 }20 sid21 {22 color:blue;23 font-size:16pt;24 display:inline;25 line-height:30px;//表格高度26 27 }28 sname29 {30 color:red;31 font-size:12pt;32 text-decoration:underline;33 display:inline;34 line-height:30px;35 36 }37 sclass,scourse,teacher38 {39 40 color:green;41 font-size:12pt;42 display:inline;43 line-height:30px;44 }
參考連結:http://xml.jz123.cn/xml_display.asp.htm
http://www.divcss5.com/rumen/r119.shtml
使用CSS來顯示XML