• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

css 搞代码 7年前 (2018-06-11) 206次浏览 已收录 0个评论

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

  下面我们开始制作:

  第一步:

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

  第二步:

  在上面已经建立好的表格的单元格中分别插入一个1×1的表格,高度值和宽度值均设为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 onclick=window.open(“http://www.ccidnet.com/school/web&#8221;,”_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 onclick=window.open(“http://www.ccidnet.com/news&#8221;,”_blank”) cellpadding=”0″ cellspacing=”0″>
<tr>
<td>资讯中心</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>技术天地</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>软件特供</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>IT财经</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>市场专家</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>互动学校</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>DIY专区</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>媒体全文</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>IT罗盘</td>
</tr>
</table>
</td>
<td width=”10%”>
<table width=”100%” border=”0″ height=”100%” class=up cellpadding=”0″ cellspacing=”0″>
<tr>
<td>IT人才</td>
</tr>
</table>
</td>
</tr>
</table>

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

欢迎大家阅读《用CSS滤镜巧制3D按钮式导航条_css》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:用CSS滤镜巧制3D按钮式导航条_css

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址