2006-01-07

不用图像构造圆角框

来源: 本站收集整理 作者:佚名 评论 0 条
 

In this example, I rounded a form and its labels with two js calls:

Rounded("form","#FFF","#BBD8FF");

Rounded("label","#BBD8FF","#FFF","small");

Example eight: final example

This is the final example wich uses some of the techniques we saw in the previous ones. In this case, I did not use embedded css or javascript. The head section contains the following lines:

<link rel="stylesheet" type="text/css" href="roundedPage.css">

<link rel="stylesheet" type="text/css" href="niftyCorners.css">

<link rel="stylesheet" type="text/css" href="niftyPrint.css" media="print">

<script type="text/javascript" src="nifty.js"></script>

<script type="text/javascript" src="final.js"></script>

The final.js contains all the javascript calls, let's see its content:

window.onload=function(){

 if(!NiftyCheck())

  return;

 RoundedTop("div#container","#FFF","#e7e7e7");

 RoundedBottom("div#container","#FFF","#E9F398");

 RoundedTop("ul#nav li","transparent","#E8F0FF");

 Rounded("div#box","#C0CDF2","#E4E7F2");

 Rounded("div#minipics li","#C0CDF2","#FFF");

 RoundedTop("div.gradient","#C0CDF2","#B8B8B8");

 RoundedBottom("div.gradient","#C0CDF2","#ECECF2");

}

A good practice is in fact avoiding using embedded javascript or CSS in the head section.

Quite easy, isn't it? If we'd use one of the css techiques based on background images, probably we'd used 18 images, maybe some extra and non-semantic wrapper and a lot of css declaration. Could you imagine the kilobytes that were spared? Probably, about 18-20Kb or so.


共4页: 上一页 [1] [2] [3] 4 下一页
(本文仅表明作者个人观点,不代表本站及其管理员立场.) 推荐 收藏 投稿 打印 返回 关闭
上一篇:CSS的常用技巧放送  
下一篇:巧用样式表,让文本框与按钮变个样
    评论加载中…
 热门排行
 推荐文章
     

 相关文章
网站首页  -  网站地图 -   站长论坛  -  网站投稿  -    -  网站管理
Copyright © 2008 芜湖站长站 All Rights Reserved 皖ICP备07500611号