An exercise.
The fast CSS rules are saying, among other things, that a CSS selector is evaluated right to left, that the selector should be very specific, and that we should avoid descendant selector as much as possible.
Two things:
- no IE6- support needed
- fast CSS
made me come up with this practice code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Nested li</title>
<style type="text/css">
#some-list li,
#some-list .first-nested-list>span {
border-bottom-width:1px;
border-bottom-style:dotted;
border-bottom-color:#5c8727;
}
#some-list .first-nested-list>span {
display:block;
}
#some-list .first-nested-list {
border:none;
}
</style>
</head><body>
<ul id="some-list">
<li>Item 1</li>
<li class="first-nested-list">
<span>Item 2</span>
<ul>
<li>Item 1</li>
<li>Item2</li>
</ul>
</li>
<li>Item 3</li>
</ul>
</body></html>
As an exercise, it doesn’t matter if the difference in speed is high or low. It matters only if there is one. Also, are the fast CSS rules and the power of cascade nullifying each other?