标签:style blog http color ar sp strong div on
派生选择器: 只改变li 下的strong
li strong {
font-style: italic;
font-weight: normal;
}
id选择器: id 可被用作派生选择器:
div#sidebar {
border: 1px dotted #000;
padding: 10px;
}
#sidebar p {
font-style: italic;
text-align: right;
margin-top: 0.5em;
}
#sidebar h2 {
font-size: 1em;
font-weight: normal;
font-style: italic;
margin: 0;
line-height: 1.5;
text-align: right;
}
类选择器:和 id 一样,class 也可被用作派生选择器:
.center {text-align: center} .fancy td { color: #f60; background: #666; }
td.fancy { color: #f60; background: #666; } <td class="fancy">
属性选择器:
[title]
{color:red }
适用于所有包含title的
[title="w3c"]
{color:red }
适用于title="w3c"
[title~="w3c"] {color:red}
适用于空格连接的值,如: title=“w3c hehe” tile="hh w3c"
[title |="w3c"] {color:red}
适用于以“-”连接的值,如:title="w3c-hhhh" title="w3c"
<head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head>
<head> <style type="text/css"> hr {color: sienna;} p {margin-left: 20px;} body {background-image: url("images/back40.gif");} </style> </head>
<p style="color: sienna; margin-left: 20px"> This is a paragraph </p>
http://www.w3school.com.cn/css/css_howto.asp
标签:style blog http color ar sp strong div on
原文地址:http://www.cnblogs.com/beyondbycyx/p/4093939.html