样式表中的选择器 作用:用于选则控件,设置样式 常用的样式选择器: 一、基础样式选择器 1、id选择器 用#来选择 ps:id是唯一的不允许重复 #id的名称{ 样式:值 } -------给id为指定名称的控件,设置样式 css代码如下: <style type="text/css"> #box1{ /* 宽度为200px */ width: 200px; /* 高度为200px */ height: 200px; /* 背景颜色 */ background-color: aquamarine; } </style> 效果如图: