我的一亩三分地 我就喜欢!
13fen  设为主页
 收藏本站
 
当前位置: > 一亩三分地:首页 > 网络学院 > 网页设计 > Html/Css > 用CSS滤镜巧制3D按钮式导航条
热门文章排行
热门文章排行 网页上传常见问题分析(11-24)
五彩缤纷建网页(一)(10-11)
五彩缤纷建网页(二)(10-11)
五彩缤纷建网页(三)(10-11)
五彩缤纷建网页(四)(10-11)
精采文章排行
精采文章排行 网页技巧二十例(11-13)
模仿QQ和MSN消息提示的效果(11-13)
根据分辨率不同调用不同的css文件(11-13)
Dreamweaver 基础 :DW的"文档"工具(11-01)
Dreamweaver 基础 :DW的"文档"窗口(11-01)
技术专题推荐
网管论坛交流
 

用CSS滤镜巧制3D按钮式导航条 

作者:Admin   来源:Linux 宝库   点击:   日期:2006-12-09


-->

  平面的导航条看多了,想不想做个3D的,当然制作的方法很多,真是仁者见仁,智者见智。我试着做了个按钮式的,效果还不错,每一个菜单项看起来都是一个个的按钮,制作方法也不复杂,并且大小只有几k,算瘦小的了。你只要有点html和CSS的基础知识就够了。


  下面我们开始制作:








  第一步:


  用Dreamweaver建立一个3x1的表格,宽度为70px,不设高度值,边框设为0,间距(cellspacing)为2。


  第二步:


  在上面已经建立好的表格的单元格中分别插入一个1x1的表格,高度值和宽度值均设为100%,边框和间距都设为0,并在每个表格中填上菜单名称。


代码是:





<table width="70" border="0" cellpadding="0" cellspacing="2">
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%">
<tr>
<td >互动学校</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%">
<tr>
<td>市场专家</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0" height="100%">
<tr>
<td>资讯中心</td>
</tr>
</table>

第三步:


现在我们建立两个CSS样式分别取名为up和down,代码如下:





.up{
border:3 outset royalblue;color:yellow;font:12px;text-align:center;background:blue;cursor:hand
}

说明:边界为3,采用outset即突起样式,颜色为royalblue,字体颜色为黄色,字体大小为12px,居中对齐,背景颜色为blue,鼠标式样为手型。





.down{
border:3 inset royalblue;color:#33ff33;font:12px;text-align:center;background:blue;cursor:hand;position: relative; left: 1px; top: 1px
}

说明:边界样式为inset即内凹,字体颜色为#33ff33,position: relative; left: 1px; top: 1px可以产生1个像素的位移,这样按钮按下去时效果好些。


  第四步:


对第二步所做的表格添加样式和行为,即在table标签后加上下列代码:





class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" onclick=window.open("http://www.ccidnet.com/school/web","_blank")

说明:在通常以及鼠标弹起和移出时采用up样式,在鼠标按下时采用down样式,链接采用onclick,不要用a,因为后者在访问后会留下难看的虚线框。


  另外,你还可以再加点修饰,如CSS滤镜等,不过切忌太花哨,否则反而效果不好!


  为了方便你学习,下面提供了全部的代码,你可以把它们复制到写字板,生成一个txt文件,然后把文件扩展名该成htm,就可以用IE直接打开了!






<html>
<head>
<title>3D按钮式导航条</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style>
body{text-align:center;background:#ffffff}
.up{
border:3 outset royalblue;color:yellow;font:12px;text-align:center;background:blue;cursor:hand
}
.down{
border:3 inset royalblue;color:#33ff33;font:12px;text-align:center;background:blue;cursor:hand;position: relative; left: 1px; top: 1px; clip:rect( )
}
</style>
</head>
<body>
<table width="700" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" onclick=window.open("http://www.ccidnet.com/news","_blank") cellpadding="0" cellspacing="0">
<tr>
<td>资讯中心</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>技术天地</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>软件特供</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT财经</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>市场专家</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>互动学校</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>DIY专区</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>媒体全文</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT罗盘</td>
</tr>
</table>
</td>
<td width="10%">
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT人才</td>
</tr>
</table>
</td>
</tr>
</table>


  <p>&nbsp;</p>
<table width="70" border="0" cellpadding="0" cellspacing="2">
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" onClick=window.open("http://www.ccidnet.com/news","_blank") cellpadding="0" cellspacing="0">
<tr>
<td>资讯中心</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>技术天地</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>软件特供</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT财经</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>市场专家</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>互动学校</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>DIY专区</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>媒体全文</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT罗盘</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" height="100%" class=up onMouseDown="className='down'" onMouseUp="className='up'" onMouseOut="className='up'" cellpadding="0" cellspacing="0">
<tr>
<td>IT人才</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>





文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【论坛讨论

   相关文章:
·在状态栏中实现活动文字效果 ·DW+ASP玩转动态二级菜单
·鼠标事件的基础和完美实现 ·DW滑动菜单的制作
·网页里震动的效果怎么做 ·灵活运用DREAMWEAVER的SITE功能

   文章评论:(条)
  
 请留名: 匿名评论   点击查看所有评论 网管论坛
 

  责任编辑:一分  声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。