1 2 3 4 5 6
<div> <span>IPAd <span>PC</span> </span> </div> <span>Printer</span>
1 2
span { color: red; } div ~ span { color: blue; }
span { color: red; } div > span { color: blue; }
1 2 3 4 5 6 7 8
<ul class="shopping-list" id="awesome"> <li> <span>IPad</span> </li> <li class="favourite" id="must-buy"> <span class="highlight">PC</span> </li> </ul>
.shopping-list .favourite { color: red; } #must-buy { color: blue; }
ul#awesome .favourite { color: red; } #ul.shopping-list li.favourite span { color: blue; }
1 2 3
<div id="test1"> <span id="test2"></span> </div>
1 2 3 4
#test2 { background-image: url('mypic.jpg'); display: none; }
1
@media only screen and (max-width: 1024px) { margin: 0; }
<head> <link href="main1.css" rel="stylesheet"> <script> alert('Hello World'); </script> </head>
var foo = 1; function bar() { foo = 10; return; function {} } bar(); alert(foo);