1. 程式人生 > >div和span;選擇器

div和span;選擇器

<ul id="mainNav">

<li>Home</li>

<li>About Us</li>

<li>Contact</li>

</ul>

p{color:black;}

a{text-decoration:underline;}

h1{font-weight:bold;}

li a{text-decoration:none;}

#intro {font-weight:bold;}

.datePosted{color:green;}

<p id="intro">Some Text</p>

<p class="datePosted">24/3/2006</p>

#mainContent h1{font-size:1.8em;}

#secondaryContent h1{font-size:1.2em;}

<div id="mainContent">

<h1>Welcome to my site</h1>

...</div>

<div id="secondaryContent">

<h1>Latest news</h1>

...

</div>

a:link{color:blue;}

a:visited{color:green;}

a:hover,a:active{color:red;}

tr:hover{background-color:red;}

input:focus{background-color:yellow;}

*{

padding:0;

margin:0;

}

#nav>li{background:url(folder.png)no-repeat left top;

<ul id="nav">

<li>Home</li>

<li>Services

<ul>

<li>Design</li>

<li>Development</li>

<li>Consultancy</li>

</ul></li>

<li>Contact Us</li>

</ul>

#nav li{backgrounde:url(folder.png)no-repeat left top;}

#nav li *{background-image:none;}

h1+p{font-weight:bold;}

<h1>Main Heading</h1>

<p>First Paragraph</p>

<p>Second Paragraph</p>