yuicompressor+ant 混淆压缩多个js和css文件方法
1、下载 yuicompressor 包
首先到官方网站 http://yuilibrary.com/downloads/#yuicompressor 上下载 yuicompressor-2.4.2.zip 资源包。解压后 yuicompressor-2.4.2.jar 在 yuicompressor-2.4.2\build 目录下。
2、创建build-yui.xml 文件
然后创建ant 运行的文件,内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<project name="MyTask" basedir="." default="compress-css">
<property name="src.dir" value="./src"/>
<target name="compress-js">
<apply executable="java" parallel="false" failonerror="true"
dest="${src.dir}/dest"
append="false" force="true">
<fileset
dir="${src.dir}"
includes="js/**.js" />
<arg line="-jar" />
<arg path="yuicompressor-2.4.2.jar" />
<arg line="--charset utf-8" />
<srcfile />
<arg line="-o" />
<mapper type="glob" from="*.js" to="*.js" />
<targetfile />
<arg line="--nomunge" /><!--只压缩去掉空格,不混淆-->
</apply>
</target>
<target name="compress-css">
<apply executable="java" parallel="false" failonerror="true"
 
相关文档:
这个bug,主要是一个二级菜单,在ie7中hover时正常显示出来,在ie6下没有效果。在网上找了很多资料,弄了好几天,最终是参照别人的代码,用的纯css经过自己的整理,就把它给弄下来了。希望以后自己多来看看。
如下:
-------------------
css代码:
.allMenu
{
width: 8 ......
1. 定义样式
1.1 按html标签定义
例如:body{background-color:#999999; text-align:center}
1.2 按类定义
例如:.style1{border-style:solid; border-color:#0000FF; border-width:1px}
1.3 按id定义
例如:#style2{border-style:solid; border-color:#FF0000; border-width:1px}
2. CSS的位置和引用
......
<!---------<html>
<head>
<style type="text/css">
.tabheader table {
border-collapse: collapse; /* for IE */
border-spacing: 0; /* for N6 */
}
.tabheader table tr td {mar ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>Cross-Browser Text Glow Demo</title>
<mce:style type="text/css"><!--
* {
font ......
选择器的分组
意思就是说几个选择器可以同时使用一个声明,但是选择器之间记住一定要用逗号来隔开,这样我们会节省了很多代码
我们举个例子吧!
h1,h2,h2,h3,h5,h6 {
color: red; background:blue;
}
这样所有的h标题标签的字体颜色是红色,背景是蓝色;应该清楚了吧!
css继承性的问题
子元素继承父元素的 ......