请高手讲下CSS格式问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:56:09
我是个新手,在网上看了好多代码,总不知道将代码放在那里,
例1:〈style type="text/css"〉
〈!--
a:link { text-decoration: none} “a“一定要起这个名字吗?
a:active { text-decoration: none }
a:visited { text-decoration: none }
--〉
〈/style〉
例1是定义类吗?

例2:BODY { color: green } 这种代码方那里?
P { color: yellow}
请详细讲一下,谢谢!

CSS代码可以放到3种地方:
[1].内联的:
<p style="color:red">text</p>
[2].放在head 之间:
<head>
<style type="text/css">
a:link,
a:visited{
text-decoration:none;
}
</style>
[3]实用外部的CSS文件
如在<head></head>之间加入]
<link href="style.css" rev="stylesheet" type="text/css" />
然后再style.css中写相应的CSS代码就好 了

例一属于低2种,例2属于第3种
要是想学习CSS的话,有很多网站的,可以的话自己搜索下吧,适合你的才是最好的

放到<head></head>之间.

格式为
<head>
<style language=css>
...
...
</style>
</head>