本文实例讲述了JS实现弹性菜单效果代码。分享给大家供大家参考。具体如下:
这是一款Javascript+CSS实现弹性菜单——纯属自己写着练习,无使用第三方的类库,我觉得是值得学习前端设计的朋友参考的,有兴趣的朋友可以把弹性的菜单背景换成一个漂亮的图片,这样更漂亮了。
运行效果截图如下:
在线演示地址如下:
http://demo.jb51.net/js/2015/js-tx-move-menu-style-codes/
具体代码如下:
Js实现菜单弹性菜单 body, ul, ol, dl, dt, dd, h1, h2, h3, h4, h5, p, form { padding: 0; margin: 0; } li { list-style: none; } img { border: 0; } body { font-family: Arial; background: #fff url() repeat-x; } #header { width: 960px; height: 107px; margin: 0 auto 12px; position: relative; } #header h1 { padding-top: 15px; float: left; } #header ul { height: 44px; position: absolute; right: 0; bottom: 0; } #header .normal, #header .active { float: left; width: 88px; height: 44px; position: relative; z-index: 1; } #header .normal a, #header .active a { float: left; width: 88px; height: 44px; line-height: 44px; text-align: center; text-decoration: none; font-size: 14px; font-weight: bold; } #header .active a { color: #fff; } #header .normal a { color: #999; } #btn_bg { width: 88px; height: 44px; background: #fb2347 url(); position: absolute; overflow:hidden; left: 608px; bottom: 0; z-index: 2; } #btn_bg ul { width: 528px; left:-176px; position:absolute; }
- 首页
- 叶子课程
- 叶子资源
- 留言
- 叶子博客
- 联系叶子
- 首页
- 叶子课程
- 叶子资源
- 留言
- 叶子博客
- 联系叶子
希望本文所述对大家的Javascript程序设计有所帮助。



