<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <link href="Untitled-7.css" rel="stylesheet" type="text/css" /> </head> <body> <!--内联样式表--> <p style="color:#F00">内联样式表,标签选择器</p> <p class="main">class选择器</p> <p id="main">id选择器</p> <div>用,分隔,与下一条语句构成复合选择器</div> <a href="http://www.baidu.com/" style="text-decoration:none">百度一下</a> </body> </html>
@charset "utf-8"; /* CSS Document */ <style> *{ margin:0px; padding:0px;} /*选择器*/ /*1、标签选择器 */ p{ text-decoration:underline; color:#0F0} /*class选择器*/ .main{ font-size:18px; text-align:center;} /*id选择器*/ #main{ background-color:#FF0; } /*复合选择器,用逗号分开,表示并列*/ div,a{ font:"Arial Black", Gadget, sans-serif; color:#00F; } </style>