Great Html Tab Panel Using CSS and Javascript
I needed a tab pane to put some content in my web pages. There are many solutions around
and I must say that they are quite good, but I had some extra requirements that I needed.
I did search around but I did not find what I wanted, so I ended up producing something and now I am sharing
it with you. The idea is not just to share the code but also explain
the issues involved.
The Tabbed Pane Content should be all downloaded with the page
This is quite a Web 2.0 thing, and I must say it was not an absolute requirement, but since I am at it
I may as well do it in a good way.
The requirement is that the content of the panels should be downloaded with the page that defines the panels
and therefore when the user switches panels there will not be any delay, the content is already there
.
The tab Panel should coexist with other content
Quite a few of the tabbed panels around basically take over the content. This simply means that
you design the page around the tabbed pane and it is quite difficult to put extra content in it.
I wanted a tab panel that fits inside some content I have
and not one that takes over my page.
Note that this means avoiding as much as possible fixed width and height
and using as much as possible
all the available screen size. Not easy...
The issues that have been solved
Before giving you the solution I will describe the issues involved, so you can understand better
what the code does and change it to suit your needs.
Where to store the different content
I could have stored the content in a Javascript variable and then push
it into
the current DIV (this may be something I do in the future) but as it is now I am inserting the
content of the different panels into different DIV, each one having a separate ID. This surely makes writing the
actual content of the panel easy.
How to overlap the various DIV
This is kind of simple, the way to overlap content is by means of using a DIV set to relative positioning
and then putt
相关文档:
visibility: hidden, visible
display: block, inline, none
visibility: 控制页面元素的显示和隐藏,不空值元素的位置特征。
document.getElementById("div").style.visibility = "hidden"; //隐藏元素
document.getElementById("div").style.visibility = "visible"; //显示元素
当元素在页面是隐藏时, ......
第一步:规划网站,本教程将以图示为例构建网站
1.规划网站,本教程将以下图为例构建网站。
点击看大图
其基本布局见下图:
点击看大图
主要由五个部分构成:
1.Main Navigation 导航条,具有按钮特效。 Width: 760px Height: 50px
2.Header 网站头部图标,包含网站的logo和站名。 Width: 760px Height: 15 ......
这段时间在学习css,总结了一些技巧来和大家分享下:
1、使用 line-height 垂直居中
line-height:24px;
使用固定宽度的容器并且需要一行垂直居中时,使用 line-height 即可(高度与父层容器一致),更多的垂直居中总结可以看这里。
2、清除容器浮动
#main {
overflow:hidden;
}
......
很多人忽视了HTML标签META的强大功效,一个好的META标签设计可以大大提高你的个人网站被搜索到的可能性,有兴趣吗,谁我来重新认识一下META标签吧!
META标签是HTML语言HEAD区的一个辅助性标签,它位于HTML文档头部的<HEAD>标记和<TITLE>标记
之间,它提供用户不可见的信息。meta标签通常用来为搜索引擎robo ......
这些都是之前学习的时候总结的,现在把它们都上传上来:
DIV+CSS面试八个题是之前在哪个网站看到了,现在怎么也找不到了,索性自己留一份吧!
一、超链接访问过后hover样式就不出现的问题?
被点击访问过的超链接样式不在具有hover和active了,解决方法是改变CSS属性的排列顺序: L-V-H-A
二、IE6的双倍边距BUG
......