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>
  • 相关阅读:
    使用MSXML2::IXMLDOMDocument2Ptr每次都要CreateInstance和load(xmlfile)吗?
    .Net程序安装打包的一些经验贡献
    感慨SQL2005中的数据挖掘算法
    COM客户端没法激活托管代码生成的COM Server的原因
    预感~=命中注定
    创业经理10大必备素质
    全局缓存管理工具
    XML DOM的结构概念图解哪里是Element,哪里是Attribute,哪里是Text
    用GetVolumeInformation得到的不是硬盘的序列号,不要再抄这样的错误好吗?
    站在生活的背后
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4131180.html
Copyright © 2011-2022 走看看