1、学习精准切图
之前切psd文件的时候,都是粗略切图,用切片工具切出一个个的矩形,然后存储为web所用格式。但是,现在设计师会用一些不规则的图形来让页面更加美观,所以需要精准切图。现介绍步骤如下:
选中需要的图层,右键复制组合,新建,再点击图像-裁切,最后存储为web所用格式即可。
2、高度自适应
很多时候,页面需要根据内容高度自适应,要实现自适应高度很简单。
首先,切图的时候,将背景切为3部分,顶部top,中间body,底部bottom。将top和bottom布局好,高度自适应主要是body部分的css。
不要给body指定height值,则height默认为auto,这时候只要再加一句overf:hidden,即可实现高度自适应。
#age-top{
width: 620px;
height: 82px;
background: url(../images/age_top.jpg) no-repeat;
padding-left:10px;
padding-right: 10px;
}
#age-body{
width: 620px;
background: url(../images/age_sider.png) repeat-y;
padding:0px 10px;
overflow:hidden;
}
#age-bottom{
width:620px;
height: 53px;
background: url(../images/age_bottom.jpg) no-repeat;
padding: 0px 10px;
}