平时总说如何如何优化,今天就详细的写一下css如何优化,嘿嘿。
首先,CSS的优化工作主要从两个方面着手
<span style="color: #008080;">1</span> <span style="color: #000000;">.test{
</span><span style="color: #008080;">2</span> <span style="color: #000000;"> background: #000 url(image.jpg) left top no-repeat;
</span><span style="color: #008080;">3</span> <span style="color: #000000;">}
</span><span style="color: #008080;">4</span> <span style="color: #000000;">background-image: url(image.jpg);
</span><span style="color: #008080;">5</span> <span style="color: #000000;">background-position: left top;
</span><span style="color: #008080;">6</span> background-repeat: no-repeat;<span style="color: #000000;">{margin-top: 5px; margin-right: 10px; margin-bottom: 5px; margin-left: 10px;}
{margin: 5px 10px 5px 10px;} 顺时针
{border-top: 2px; border-right: 5px; border-left: 10px; border-bottom: 3px;}
{border: 2px 5px 10px 3px;}</span><span style="color: #000000;">{font: oblique bold 16px/35px Helvetica,Arial}
font-style: oblique;
font-weight:bold;
font-size: 16px; line-height:35px;
font-family:Helvetical,Arial;</span>border:5px solid red; <span style="color: #008080;">1</span> border:<strong>border-width</strong>,<strong>border-style</strong>,<strong>border-color</strong>;
@import<link> 标签相比,@import 指令要慢很多,不光增加了额外的请求次数,还会导致不可预料的问题。替代办法有以下几种: 使用多个 <link> 元素,最好是发布的时候合并压缩css,减少http请求个数利用继承
说到继承,就需要了解权重相关知识,也顺便总结一下各种情况下哪个属性优先,防止滥用属性
立即学习“前端免费学习笔记(深入)”;
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号