分享
 
 
 

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

王朝html/css/js·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

平面的导航条看多了,想不想做个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>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有