---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ----------------------
在css中样式选择器有很多种,对于元素内联的样式需要定义样式选择器,通俗的说就是这个样式适合哪些元素。常用的选择器有三种:
标签选择器、class选择器、id选择器
一、标签选择器
input{border-color:yellow;color:Red}
对于指定的标签采用统一的样式;
二、class选择器
以定义一个命名的样式,然后再用到它的时候设定元素的class属性为样式名称,还可以同时设定多个class、名称间加空格;
样式名称开头加“.”
.warning{background:Yellow;}
.highlight{font-size:xx-large;cursor:help;}
<table>
<tr><td class="highlight">aaa</td><td class="warning">bbb</td><td class="highlight">ccc</td></tr>
</table>
三、id选择器
为指定id的元素设定样式,id前加#
#username{font-size:xx-large;}
<input id="username" type="text" value="aaa" />
另外,style、id和class可以同时组合使用
<input id="username" class="accountno" style="font-size:xx-large" type="text" value="aaa" />
---------------------- Windows Phone 7手机开发、.Net培训、期待与您交流! ----------------------详细请查看:http://net.itheima.com/