DIV的圆角表现和TAB切换
内容大体是从网上找过来的,感觉那位哥们说的对,css还是比较靠谱的,当然有些高玩搞出来的东西本地
没有运行起来。
把自己的应用贴出来同大家分享
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<title>Div with fillet set and Tab change</title>
<style type="text/css">
/* div with fillet setting style*/
b.rtop, b.rbottom{
display:block;
background: white; /* set this color as same as bgcolor*/
}
b.rtop b, b.rbottom b{
display:block;
height: 1px;
overflow: hidden; /* the soul to solve this problem*/
background:#6DA6D9
} b.rbottom b.r1{
margin: 0 5px
}
b.rbottom b.r2{
margin: 0 3px
}
b.rbottom b.r3{
margin: 0 2px
}
b.rbottom b.r4{
margin: 0 1px;
height: 2px
} b.rtop b.r1{
margin: 0 5 0 0px
}
b.rtop b.r2{
margin: 0 3 0 0px
}
b.rtop b.r3{
margin: 0 2 0 0px
}
b.rtop b.r4{
margin: 0 1 0 0px;
height: 2px
} </style>
<script type="text/javascript">
// tab change
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var con=document.getElementById("con_"+name+"_"+i);
con.style.display=i==cursel?"block":"none";
} // back ground color
var bgcolor;
if(cursel==1){
bgcolor="#6DA6D9";
} else if(cursel==2){
bgcolor="#FF7D93";
} else if(cursel==3){
bgcolor="#8FC26C";
} else if(cursel==4){
bgcolor="#D2A000";
}
document.getElementById("contentscroll").style.background=bgcolor;
document.getElementById("r1top").style.background=bgcolor;
document.getElementById("r2top").style.background=bgcolor;
document.getElementById("r3top").style.background=bgcolor;
document.getElementById("r4top").style.background=bgcolor;
document.getElementById("r1buttom").style.background=bgcolor;
document.getElementById("r2buttom").style.background=bgcolor;
document.getElementById("r3buttom").style.background=bgcolor;
document.getElementById("r4buttom").style.background=bgcolor; // fillet set
if(cursel!=1){
document.getElementById("r1top").style.margin="0 5px";
document.getElementById("r2top").style.margin="0 3px";
document.getElementById("r3top").style.margin="0 2px";
document.getElementById("r4top").style.margin="0 1px";
} else {
document.getElementById("r1top").style.margin="0 5 0 0px";
document.getElementById("r2top").style.margin="0 3 0 0px";
document.getElementById("r3top").style.margin="0 2 0 0px";
document.getElementById("r4top").style.margin="0 1 0 0px";
} } </script>
</head> <body>
<div class="Menubox">
<span id="tab1" style="background: #6DA6D9; cursor: pointer;" onclick="setTab('tab',1,4)" >tab1</span>
<span id="tab2" style="background: #FF7D93; cursor: pointer;" onclick="setTab('tab',2,4)" >tab2</span>
<span id="tab3" style="background: #8FC26C; cursor: pointer;" onclick="setTab('tab',3,4)" >tab3</span>
<span id="tab4" style="background: #D2A000; cursor: pointer;" onclick="setTab('tab',4,4)" >tab4</span>
</div>
<div id="ContentBox" style="width: 800px;" >
<b class="rtop">
<b id="r1top" class="r1"></b>
<b id="r2top" class="r2"></b>
<b id="r3top" class="r3"></b>
<b id="r4top" class="r4"></b>
</b>
<div id="contentscroll" style="overflow-y: auto; height: 400px; width: 800px; border-color: white; background-color: #6DA6D9;">
<!-- tab block 1 -->
<div id="con_tab_1" style="margin: 0 20px; border-style: solid; border-color: #33339A; border-width: 0px;background-color: #6DA6D9;">
<h3>tab block 1</h3>
</div>
<!-- tab block 2 -->
<div id="con_tab_2" style="margin: 0 20px; border-style: solid; border-color: #33339A; border-width: 0px; background-color: #FF7D93; display:none;">
<h3>tab block 2</h3>
</div>
<!-- tab block 3 -->
<div id="con_tab_3" style="margin: 0 20px; border-style: solid; border-color: #33339A; border-width: 0px; background-color: #8FC26C; display:none;">
<h3>tab block 3</h3>
</div>
<!-- tab block 4 -->
<div id="con_tab_4" style="margin: 0 20px; border-style: solid; border-color: #33339A; border-width: 0px; background-color: #D2A000; display:none;">
<h3>tab block 4</h3>
</div>
</div>
<b class="rbottom">
<b id="r4buttom" class="r4"></b>
<b id="r3buttom" class="r3"></b>
<b id="r2buttom" class="r2"></b>
<b id="r1buttom" class="r1"></b>
</b>
</div>
</body>
</html>
DIV的圆角表现和TAB切换的更多相关文章
- DIV+CSS 样式简单布局Tab 切换
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> &l ...
- tab切换的效果——仿照今日头条APP的切换效果
说点废话;不知道是哪一版本起头条的tab切换效果就变了,一直琢磨着这个事,去度娘那里也没有什么结果:正好这两天有空就尝试做了一下:用前端的技术来实现: 先看效果吧:上面的tab随着slide滑动,上面 ...
- CSS3 :target伪类实现Tab切换效果
用:target伪类实现Tab切换效果真的非常简单!简单到什么程度呢?它只需要下面这些代码. style.css: .song-info { position: absolute; backgroun ...
- tab切换效果
选项卡是一个神奇的网页效果,不论大小网站,比如B2B像阿里巴巴,慧聪网,还有B2C这个不用说了吧,爱逛网店的童鞋们都知道的,像京东商城,淘宝网,拍拍网,一号店,凡客诚品,等等各种网各种网店,选项卡不仅 ...
- 谈谈一些有趣的CSS题目(八)-- 纯CSS的导航栏Tab切换方案
开本系列,谈谈一些有趣的 CSS 题目,题目类型天马行空,想到什么说什么,不仅为了拓宽一下解决问题的思路,更涉及一些容易忽视的 CSS 细节. 解题不考虑兼容性,题目天马行空,想到什么说什么,如果解题 ...
- jquery+bootstrap实现tab切换, 每次切换时都请求数据, 点击提交分别向不同的地址提交数据
今天一个朋友叫帮做一个tab切换, 每一个tab内容区域都是从后台取出的数据, 这些数据要用表格的形式显示处理, 并且表格的内容区域可以修改, 如下所示: 例子查看请演示查看. 截图如图所示: 实现步 ...
- 基于zepto的H5/移动端tab切换触摸拖动加载更多数据
以前实现移动端的滑动加载更多实现的方法是当滚动条快到页面底部时就自动加载更多的数据,在这方面很多人都用的是"西门的后花园"写的一个叫dropload的插件,这个插件用起来也很好,很 ...
- JavaScript的Tab切换
在网页设计中经常要用到tab切换,遂整理了一下常用的两种方法. 先看一下示例代码: HTML: <!doctype html> <html lang="en"&g ...
- jquery实现tab切换完整代码
代码如下,保存到html文件打开: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " ...
随机推荐
- oracle数据库常用SQL语句(11.29更新)
笔者日常工作中常用到的sql语句,现总结如下,留作日后查看. 1.按照两列中的最大值取 ,只取两列其中的一列 SELECT * FROM t_doc T ORDER BY GREATEST(T.Loa ...
- Hibernate中的集合映射
1.定义实体 public class User { private int userId; private String userName; private Set<String> ad ...
- jquery animate()方法使用的注意事项
当使用 animate() 时,必须使用 Camel 标记法书写所有的属性名,比如,必须使用 paddingLeft 而不是 padding-left,使用 marginRight 而不是 margi ...
- Android ViewPager 里有子ViewPager的事件冲突
在Android应用中有时候要用到类似网易新闻左右滑动页面且页面里又有左右滑动的图片功能,我不知道网易是怎么实现的,本人的做法是外面的BaseFragmentActivity布局就是TabViewPa ...
- matlab和C/C++混合编程--Mex (六)参数传递
最近的项目需要matlab和C的混合编程,经过一番努力终于完成了项目要解决的问题.现在就将Mex的一些经验总结一下,当然只是刚刚开始,以后随着学习的深入继续添加.首先讲讲写Mex的一些常规规定,然后我 ...
- [Windows驱动]驱动包(Driver Packages)
在windows下安装一个驱动,我们你需要把所有需要的软件打包-称为驱动包.驱动包里包括系统提供的给所有设备类使用的一般安装工具,还包括了设备商提供的设备特定的组件.下面我们就来看看驱动包里具体需要哪 ...
- 记录一些容易忘记的属性 -- UIGestureRecognize手势
//一个手势只能添加到一个view上面 //设置当前手势需要的点击次数 _tapRec.numberOfTapsRequired = 1;//(默认为1) //设置当前需要几个手指同时点击 ...
- sql 解析字符串添加到临时表中 sql存储过程in 参数输入
sql 解析字符串添加到临时表中 sql存储过程in 参数输入 解决方法 把字符串解析 添加到 临时表中 SELECT * into #临时表 FROM dbo.Func_SplitOneCol ...
- PHPSESSID的cookie
如果PHP脚本中有: 1 session_start(); 则说明使用了SESSION. SESSION是一种机制,可以在服务器端跨文件暂时保存数据或传递数据,常用于购物车等方面. SESSION只在 ...
- TCP同步传送数据示例以及可能出现问题分析
TCP传送数据可以分为同步传送和异步传送,首先这里使用了TCP的同步传送方式,学习了TCP同步传送数据的原理. 同步工作方式是指利用TCP编写的程序执行到监听或者接受数据语句的时候,在未完成当前工作( ...