css3制作tab卡片选中小尖角
2016-03-31 12:46
162 查看
tab选项卡在网页中经常会用到,下面是制作一种箭头指示选中效果的写法。
实现效果
源码下载
http://pan.baidu.com/s/1pLio36V
实现效果
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>酒邻居</title> <link href="css/main.css" rel="stylesheet" media="screen" type="text/css" /> <script src="js/jquery-1.9.1.min.js"></script> <style type="text/css"> .tabcss { width: 15px; transform: rotate(45deg); background-color: white; position: relative; height: 15px; bottom: -10px; left: 50%; margin-left: -7.5px; } </style> </head> <body> <div class="nav"> <a class="backward" href="MemberInfo.aspx"></a> <span style="position: absolute; top: 15px; left: 24px; color: white; font-size: 10pt;">个人中心</span> <span class="title" style="margin-left: -24px;">积分</span> </div> <form id="Form2" method="post" runat="server"> <div class="main"> <div style="background-color: rgb(191, 57, 71); color: white;"> <div style="line-height: 30px; display: flex; width: 13em; margin: 0px auto;"> <div style="height: 1px; background-image: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.75)); margin-top: 14.5px; width: 5em;"></div> <div style="width: 5em; text-align: center;">总积分</div> <div style="height: 1px; margin-top: 14.5px; background-image: linear-gradient(to right, rgba(255, 255, 255, 0.75), transparent); width: 5em;"></div> </div> <div style="text-align: center; font-size: 25pt;"> 1200 </div> <div style="display: flex; text-align: center; height: 4em;"> <div style="flex: 1 1 0%; margin-top: 1.5em;" onclick="tabchenge(this)"> 全部积分 </div> <div style="flex: 1 1 0%; margin-top: 1.5em;" onclick="tabchenge(this)"> 积分支入 </div> <div style="flex: 1 1 0%; margin-top: 1.5em;" onclick="tabchenge(this)"> 积分支出 </div> </div> </div> <div class="data" runat="server" id="ulOrderList"> </div> <div id="Income" style="display: none"> <ul> <li style="background-color: white; white-space: nowrap; text-overflow: ellipsis; padding: 10px 20px;margin-bottom: 0.2em;"> <div style="color: black;"> 消费:玛歌菩伊乐 波尔多干白葡萄酒 </div> <div style="color: rgb(130, 130, 130); overflow: hidden; line-height: 16pt;"> <div style="float: left;"> 时间:2016.02.03 16.33 </div> <div style="float: right; font-size: 16pt; color: rgb(194, 72, 84);"> +300 </div> </div> </li> <li style="background-color: white; white-space: nowrap; text-overflow: ellipsis; padding: 10px 20px;margin-bottom: 0.2em;"> <div style="color: black;"> 消费:玛歌菩伊乐 波尔多干白葡萄酒 </div> <div style="color: rgb(130, 130, 130); overflow: hidden; line-height: 16pt;"> <div style="float: left;"> 时间:2016.02.03 16.33 </div> <div style="float: right; font-size: 16pt; color: rgb(194, 72, 84);"> +300 </div> </div> </li> </ul> </div> <div id="expenditure" style="display: none"> <li style="background-color: white; white-space: nowrap; text-overflow: ellipsis; padding: 10px 20px;margin-bottom: 0.2em;"> <div style="color: black;"> 消费:玛歌菩伊乐 波尔多干白葡萄酒 </div> <div style="color: rgb(130, 130, 130); overflow: hidden; line-height: 16pt;"> <div style="float: left;"> 时间:2016.02.03 16.33 </div> <div style="float: right; font-size: 16pt; color: rgb(194, 72, 84);"> -300 </div> </div> </li> <li style="background-color: white; white-space: nowrap; text-overflow: ellipsis; padding: 10px 20px;margin-bottom: 0.2em;"> <div style="color: black;"> 消费:玛歌菩伊乐 波尔多干白葡萄酒 </div> <div style="color: rgb(130, 130, 130); overflow: hidden; line-height: 16pt;"> <div style="float: left;"> 时间:2016.02.03 16.33 </div> <div style="float: right; font-size: 16pt; color: rgb(194, 72, 84);"> -300 </div> </div> </li> </div> </div> </form> <script type="text/javascript"> //显示选中的tab var tabsname = ["ulOrderList", "Income", "expenditure"]; function showtab(whichtab) { for (var i = 0; i < 3; i++) { if (tabsname[i] == whichtab) { $("#" + whichtab).css("display", ""); } else { $("#" + tabsname[i]).css("display", "none"); } } } //tab切换脚本 var htmlslelecttab = "<div style=\"overflow: hidden;\"><div class=\"tabcss\"></div></div>"; function tabchenge(ele) { var tabs = $(ele).parent().children(); for (var i = 0; i < 3; i++) { $(tabs[i]).html($(tabs[i]).text().trim()); if (tabs[i] == ele) { $(ele).append(htmlslelecttab); showtab(tabsname[i]); } } } </script> </body> </html>
源码下载
http://pan.baidu.com/s/1pLio36V
相关文章推荐
- 二级菜单总结
- Html+CSS input type=file 文件类型限制属性 accept (HTML 5)
- 根据浏览器显示界面大小变换,替换css文件方法
- CSS实现的loading页面等待效果
- LESS CSS 框架简介
- clearfix:after 清除css浮动
- 史上最全的CSS hack方式一览
- 笔记 - 10.4、HTML - CSS滤镜笔记
- CSS声明各个浏览器私有属性的命名前缀
- 笔记 - 10.3、HTML - CSS样式笔记1
- 笔记 - 10.2、HTML - CSS选择器笔记
- 笔记 - 10.1、HTML - CSS概念笔记
- css 兼容大全
- 用HTML+CSS实现简单的下拉列表
- CSS左侧固定宽 右侧自适应(兼容所有浏览器)
- css3小知识点收录
- float在ie浏览器上的兼容问题
- CSS实现水平垂直居中小结
- 关于CSS中float和position的使用
- 判断浏览器是否支持css3属性或单位