zoukankan      html  css  js  c++  java
  • [转载]关于怎样优化HTML以加快下载速度的10个方法

    今天在逛codeproject的时候发现了这篇文章:Ten ways to speed up the download time of your web pages:关于怎样优化HTML以加快下载速度的10个方法。

    现摘录一下,不代表本人的想法:
    1、尽量使用CSS而不是Table来控制页面外观;
    2、不要使用图片来显示特别的文字,请使用CSS;
    3、使用CSS来定义背景图片;
    3、使用连贯性文本,如:
    不要:

    <class="text">This is a sentence</p>
    <class="text">This is another sentence</p>
    <class="text">This is yet another sentence</p>
    <class="text">This is one more sentence</p>

    而要:

    <div class="text">
    <p>This is a sentence</p>
    <p>This is another sentence</p>
    <p>This is yet another sentence</p>
    <p>This is one more sentence</p>
    </div>

    5、使用简化CSS属性,如:
    不要:

    font-size: 1em;
    line-height: 1.5em;
    font-weight: bold;
    font-style: italic;
    font-family: serif

    而要:

    font: 1em/1.5em bold italic serif


    6、最小化空白文字、回车和注释;
    7、资源(图片、CSS等等)使用相对路径;
    8、移除不必的meta字段;
    9、把CSS、脚本放在外部文件中重用;
    10、在非正规HTML标签后面添加“/”结束符号。

  • 相关阅读:
    nginx1.9+新增tcp/udp代理stream
    mysql授权
    搭建GIT服务器
    Centos调出图形化的网络管理
    吾爱破解论坛纪念壁纸(怀念)
    VNC-tigervnc-server远程调用图形化
    Linux生成高强度密码
    Linux学习必备
    git编译
    书单
  • 原文地址:https://www.cnblogs.com/unruledboy/p/23147.html
Copyright © 2011-2022 走看看