方法1
使用import 方法引用CSS
1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 5 <title>控制DOM对象</title> 6 <style type="text/css" > 7 @import url(../CSS/1-3.css); /*使用import 方法引用CSS*/ 8 </style> 9 <script type="text/javascript" src="../JQuery/jquery-2.1.4.min.js"> 10 </script> 11 </head>
方法2
使用link引用CSS
1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>JQuery事件的链式写法</title> 6 <link type="text/css" rel="stylesheet" href="../CSS/1-2.css" /> <!-- 使用link引用CSS --> 7 <script type="text/javascript" src="../JQuery/jquery-2.1.4.min.js"> 8 </script> 9 <script type="text/javascript">28 </script> 29 </head>
方法3
直接将CSS代码写在HTML页面 ,格式如下:
1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title></title> 6 <style type="text/css"> 7 .divFrame { 8 width: 260px; 9 border: solid 1px #666; 10 font-size: 10pt; 11 } 12 13 .divTitle { 14 background-color: #666; 15 padding: 5px; 16 } 17 18 .divContent { 19 padding: 5px; 20 display: none; 21 } 22 23 .divCurrColor { 24 background-color: red; 25 } 26 </style> 27 </head> 28 <body> 29 </body> 30 </html>