基本选择器

html文件:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>基本选择器</title>
</head>
<body>
	<ul>
	<li>1</li>
	<li>2</li>
	<li>3</li>
	<li id="four">4</li>
	<li>5</li>
	<li class="green yellow">6</li>
	<li class="green">7</li>
	<li>8</li>
	<li>9</li>
	<li>10</li>
	</ul>
	<div class="green">111</div>
	<div class="green">111</div>
	<div class="green">111</div>
	<div class="green">111</div>
	<script src="jquery-1.12.4.js"></script>
	<script>
	//入口函数
	$(function(){   
    //jquery如何设置样式
    //css(name, value)
    //name:样式名  value:样式值
    //id选择器  $("#id")
    //$("#four").css("backgroundColor", "red");
    //$(".green").css("backgroundColor", "green");
    //$("li").css("color", "red");
    //交集 并集
    //$("#four,.green").css("backgroundColor", "pink");
    //$("li.green").css("backgroundColor", "red");
    $(".green.yellow").css("backgroundColor", "pink");
  });
	</script>
</body>
</html>

  

posted @ 2020-04-15 14:33  迷幻天空岛  阅读(97)  评论(0编辑  收藏  举报