- ·上一篇文章:qq客服未启用的解决方法
- ·下一篇文章:常用的javascript效果(一)
比较两段html代码运行效率
第一段:
<
style>
.a,.b,.c,.d
{background:transparent url(2.jpg)
width:100px
height:100px
}
.a
{
background-position: 0 0
}
.b
{
background-position: -200px -100px
}
.c
{
background-position: -300px -100px
}
.d
{
background-position: -400px -100px
}
 
<
/style>
 
<
div class="
a"
>
<
/div>
<
br>
 
<
div class="
b"
>
<
/div>
<
br>
 
<
div class="
c"
>
<
/div>
<
br>
 
<
div class="
d"
>
<
/div>
<
br>
第二段:
<
style type="
text/css"
>
.a
{
background-position: 0 0
background:transparent url(2.jpg)
width:100px
height:100px
}
.b
{
background:transparent url(2.jpg)
width:100px
height:100px
background-position: -200px -100px
}
.c
{
background:transparent url(2.jpg)
width:100px
height:100px
background-position: -300px -100px
}
.d
{
background:transparent url(2.jpg)
width:100px
height:100px
background-position: -400px -100px
}
 
<
/style>
 
<
div class="
a"
>
<
/div>
<
br>
 
<
div class="
b"
>
<
/div>
<
br>
 
<
div class="
c"
>
<
/div>
<
br>
 
<
div class="
d"
>
<
/div>
<
br>
功能是一样的,只是使用的CSS的方法不一样罢了。第一种效率会更高些。
比较两段html代码运行效率