CSS Code formatting tools
CSS code formatting tools can: Compress code, format (multiple lines), format (single line), restore code.
Easy to optimize and save space
The following is the source code:
-------------------------------------
<! DOCTYPE HTML >
<meta charset= "UTF-8" >
<title>css Formatting Tools </title>
<style type= "Text/css" >
Html,body,form,fieldset,textarea {height:100%; margin:0; padding:0; border:0; font-size:10pt; background: #eee;}
form {margin:0 1%; Overflow:hidden; }
Legend {line-height:3em; font-weight:bolder;}
button {float:left; margin:1% 1% 0 0; cursor:pointer;}
textarea {width:100%; height:20em; border:1px solid #ccc; display:block; background: #fff;}
</style>
<form action= "" onsubmit= "return false" >
<fieldset>
<legend>css Formatting Tools </legend>
<textarea name= "" rows= "" cols= "" id= "Codetext" >body * {font-size:10pt;} /* SS SDA */
P
{clear:left; padding:5px 10px;
}
Td
,
FieldSet
{padding: 10px; }
TEXTAREA {
width:90%;
Height:10em;
}
</textarea>
<button type= "button" onclick= "$ (& #39;codetext& #39;). Value=code. A (); " > Compression Codes </button>
<button type= "button" onclick= "$ (& #39;codetext& #39;). Value=code. B (); " > Format (multiple lines) </button>
<button type= "button" onclick= "$ (& #39;codetext& #39;). Value=code. C (); " > Format (single line) </button>
<button type= "button" onclick= "$ (& #39;codetext& #39;). Value=code. Z (); " > Restore Code </button>
</fieldset>
</form>
<script type= "Text/javascript" >
function $ (ID) {return document.getElementById (ID);}
function Codezip (obj) {
This. S=function () {
var Code=obj.value;
if (!this.codez| | this.codez== "") This.codez=code;
Code=code.replace (/(\n|\t|\s) */ig, ' $ ');
Code=code.replace (/\n|\t|\s (\{|\}|\,|\:|\;)/ig, ' $ $ ');
Code=code.replace (/(\{|\}|\,|\:|\;) \s/ig, ' $ $ ');
return code;
}
This. A=function () {
var code=this. S ();
return code;
}
This. B=function () {
var code=this. S ();
Code=code.replace (/(\{)/ig, ' $ ');
Code=code.replace (/(\{|\;)/ig, ' $1\n\t ');
Code=code.replace (/\t* (\})/ig, ' $1\n ');
Code=code.replace (/(\*\/)/ig, ' $1\n ');
return code;
}
This. C=function () {
var code=this. S ();
Code=code.replace (/(\})/ig, ' $1\n ');
Code=code.replace (/(\*\/)/ig, ' $1\n ');
return code;
}
This. Z=function () {
Return (This.codez)? This.codeZ:obj.value;
}
var my=this;
Obj.onkeydown=function () {
My.codez= "";
}
}
var code=new codezip ($ (' codetext '));
</script>
</body>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/73/98/wKioL1YCEyWz05LPAAJJ_Rdv2Bc473.jpg "title=" Dzq-blog.png "alt=" Wkiol1yceywz05lpaajj_rdv2bc473.jpg "/>
This article from "Wennuanyiran" blog, reproduced please contact the author!
CSS Code formatting tools