html css关联选择器和组合选择器

来源:互联网 发布:sql 添加自增列 编辑:程序博客网 时间:2024/06/05 06:43
<!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=gb2312" />
<title>无标题文档</title>
<style type="text/css">
div{
background-color:#33FF00;
color:#000000;
}
/*关联选择器,选择器中的选择器*/
div b{
background-color:#000000;
color:#33FF00;
}
/*组合选择器*/
p,span b{
background-color:#3300FF;
color:#FFFFFF;
}
</style>
</head>

<body>
    <div>封<b>装</b>行</div>
    <span>行<b>内封</b>装</span> <span>行内封装</span>
    <p>段落中的隐藏的第一桶金</p>
    <p>段落</p>
</body>
</html>

原创粉丝点击