CSS是Cascading Style Sheets的缩写.在一个网页中引入CSS有2种方式:
<link href="/css/basic.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
@import url("/css/advanced.css");
-->
</style>
也可以直接在网页中直接添加如下:
<style type="text/css">
.....
<style>
我的第一个
CSS
<html>
<head>
<title></title>
<style type="text/css">
p{
color : red ;
}
.date{
color : green ;
}
#intro {font-weight: bold;}
.datePosted {color: green;}
#mainContent h1 {font-size: 1.8em;}
#secondaryContent h1 {font-size: 1.2em;}
a:hover{
color : #FF0080 ;
}
a:active{
color : #0080FF ;
}
#nav li {font-weight: bold;}
</style>
</head>
<body>
<p>i'm red</p>
<a href="#">
你好
</a>
<div id="mainNav">
<ul>
<li>Home</li>
<li>About Us</li>
<li>Contact</li>
</ul>
</div>
<h2>Where’s Durstan?</h2>
<p>Published on <span class="date">March 22nd, 2005</span>
by <span class="author">Andy Budd</span></p>
<p id="intro">Some Text</p>
<p class="datePosted">24/3/2006</p>
<div id="mainContent">
<h1>Welcome to my site</h1>
...
</div>
<div id="secondaryContent">
<h1>Latest news</h1>
...
</div>
<ul id="nav">
<li>Home</li>
<li>Services
<ul>
<li>Design</li>
<li>Development</li>
<li>Consultancy</li>
</ul>
</li>
<li>Contact Us </li>
</ul>
</body>
</html>
posted on 2006-10-10 19:44
尨奇 阅读(244)
评论(0) 编辑 收藏 所属分类:
CSS