zoukankan      html  css  js  c++  java
  • CSS格式化 CSS代码压缩工具

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>CSS格式化 css代码在线压缩-CSS代码格式化,css在线压缩工具可减少CSS文件体积,让CSS文件更规范</title>
    <style> 
    body,textarea,input{font:11pt "微软雅黑",Tahoma;}
    </style>
    <meta http-equiv="x-ua-compatible" content="ie=7" /> 
     <script language=JavaScript> 
    <!-- 
    function $() { 
      var elements = new Array(); 
      for (var i = 0; i < arguments.length; i++) { 
      var element = arguments[i]; 
      if (typeof element == 'string') 
        element = document.getElementById(element); 
      if (arguments.length == 1)  
        return element;    
      elements.push(element); 
      }    
      return elements; 
    } 
    function CSSencode(code) 
    { 
     code = code.replace(/
    /ig,''); 
     code = code.replace(/(s){2,}/ig,'$1'); 
     code = code.replace(/	/ig,''); 
     code = code.replace(/
    }/ig,'}'); 
     code = code.replace(/
    {s*/ig,'{'); 
     code = code.replace(/(S)s*}/ig,'$1}'); 
     code = code.replace(/(S)s*{/ig,'$1{'); 
     code = code.replace(/{s*(S)/ig,'{$1'); 
     return code; 
    } 
    function CSSdecode(code) 
    { 
     code = code.replace(/(s){2,}/ig,'$1'); 
     code = code.replace(/(S)s*{/ig,'$1 {'); 
     code = code.replace(/*/(.[^}{]*)}/ig,'*/
    $1}'); 
     code = code.replace(//*/ig,'
    /*'); 
     code = code.replace(/;s*(S)/ig,';
    	$1'); 
     code = code.replace(/}s*(S)/ig,'}
    $1'); 
     code = code.replace(/
    s*}/ig,'
    }'); 
     code = code.replace(/{s*(S)/ig,'{
    	$1'); 
     code = code.replace(/(S)s**//ig,'$1*/'); 
     code = code.replace(/*/s*([^}{]S)/ig,'*/
    	$1'); 
     code = code.replace(/(S)}/ig,'$1
    }'); 
     code = code.replace(/(
    ){2,}/ig,'
    '); 
     code = code.replace(/:/ig,': '); 
     code = code.replace(/  /ig,' '); 
     return code; 
    } 
    //--> 
    </script>
    </head>
    <body>
    <table width="80%" border="0" cellspacing="3" cellpadding="0" align="center">
        <tr>
          <td>CSS代码在线压缩工具,CSS格式化,让CSS代码更规范,体积更小,有利于阅读代码和网页加载速度。而且本页提供的CSS代码格式化功能不需要使用YUI Compressor 或者 CSSTidy等离线工具,直接在线操作。</td>
        </tr>
        <tr>
          <td><textarea id=code title="请把CSS代码粘贴在这里" style="WIDTH: 100%; HEIGHT: 300px"></textarea></td>
        </tr>
        <tr>
          <td><input onClick="$('code').value = CSSdecode($('code').value);" type=button value=格式化>  <input onClick="$('code').value = CSSencode($('code').value);" type=button value=压缩化>  <input onClick="window.clipboardData.setData('Text',$('code').value);" type=button value=复制>  <input onClick="$('code').value = window.clipboardData.getData('Text');" type=button value=粘贴>  <input onClick="$('code').value = ''" type=button value=清空> </td>
        </tr>
      </table>
    </body>
    </html>
  • 相关阅读:
    mysql5.7创建用户授权删除用户撤销授权
    什么是分表和分区 MySql数据库分区和分表方法
    linux命令大全之watch命令详解(监测命令运行结果)
    netstat统计的tcp连接数与⁄proc⁄pid⁄fd下socket类型fd数量不一致的分析
    ss is one another utility to investigate sockets(特适合大规模tcp链接)
    /proc/net/sockstat 里的信息是什么意思?
    linux平台下server运维问题分析与定位
    strace命令解析
    MySQL常见错误代码及代码说明
    自动化部署必备技能—定制化RPM包
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4131180.html
Copyright © 2011-2022 走看看