问题描述
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<script type="text/javascript" src="jquery/jquery-3.3.1.min.js"></script>
</head>
<body>
<script>
$(document).ready(function(){
// $('ul>li').css('list-style','none')
$('ul li').css('list-style','none')
// $('label+input').css('height','100px')
// $('input+button').css('height','100px')
$('label~input').css('background','pink')
})
</script>
<ul>
<li>1</li>
<li>1
<li>2</li>
</li>
<li>1
<div>
<li>3
<li>4
<ul>
<li>5</li>
</ul>
</li>
</li>
</div>
</li>
<li>1</li>
<li>1</li>
</ul>
<form action="">
<label for="">姓名</label>
<input type="text"><button>按钮</button><br>
<input type="text"><button>按钮</button><br>
<input type="text"><button>按钮</button><br>
<input type="text"><button>按钮</button><br>
<input type="text"><button>按钮</button><br>
</form>
</body>
</html>
问题解答
回答1:ul>li 只找儿子元素,,除了儿子元素 其他是不找的.
ul li 找所有的元素
回答2:ul>li: 找到是ul的直接子元素的liul li: 找到ul下面的所有li