Bsie:让Bootsrap兼容IE6-8浏览器
2015-12-25 16:10:24 | 来源:玩转帮会 | 投稿:佚名 | 编辑:小柯

原标题:Bsie:让Bootsrap兼容IE6-8浏览器

Bsie(鄙视IE)是一个能让你的低版本IE(IE6-8)兼容大部分Bootstrap功能的扩展库,也许你觉得现在使用IE6是一种多么无知的行为,但是现在很多企业应用确实还是需要IE的支持,那么通过Bsie,IE用户也可以享受到大部分Bootstrap的功能和UI。下面列出了Bsie兼容Bootstrap的相关功能:

组件       特性
-----------------------------------------------------------
grid            fixed, fluid
navbar          top, fixed
nav             list, tabs, pills
dropdown        dropdown (two level)
buttons         button, group color, size, dropdown-button, 
                (disable state is not dynamic)
form            default, horizontal, inline, all controls, 
                validation state
tables          hover
pagination      all
labels          all
badges          all
code            all
modal           most
tooltip         all
popover         all
alert           all
typeahead       all
progressbar     most
media           all
wells           all
hero unit       all
icons           all
Bsie相关文件使用介绍

bootstrap/css/bootstrap.css :

这是bootstrap原始的css文件。

bootstrap/css/bootstrap.min.css :

这是bootstrap原始的压缩后的css文件。

bootstrap/css/bootstrap-ie6.css :

这是bsie的主要的css文件。

bootstrap/css/bootstrap-ie6.min.css :

这是bsie压缩后的css文件。

bootstrap/css/ie.css :

这是bsie额外添加的css补丁,这个文件中的大部分内容无法写入到 .less 文件中,并且必须紧跟在 bootstrap-ie6.css 之后在<head>中引入。

js/bootstrap-ie.js :

这个javascript补丁文件用于解决一些纯CSS无法完成工作。

bootstrap/img/glyphicons-halflings.png-8.png :

这个图片文件是针对IE6的透明格式图标,是png 8bit格式的,显示效果虽然并不是太好,但是也还可以接受。

bootstrap/less-ie6 :

这个目录下是所有打过补丁的 .less 文件,你可以用lessc命令重新编译出 bootstrap-ie6.css文件

Bsie实例介绍

在bsie目录下有以下几个案例:

test-XXX.html, 例如 test-buttons.html test-form.html

p-1.htmlp-N.html, 这几个文件都是直接从bootstrap案例中拷贝过来的

使用手册

第1步, 在<head>中添加以下css文件:

<!-- Bootstrap css file v2.2.1 -->
  <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.min.css">
  <!--[if lte IE 6]>
  <!-- bsie css 补丁文件 -->
  <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap-ie6.css">
  <!-- bsie 额外的 css 补丁文件 -->
  <link rel="stylesheet" type="text/css" href="bootstrap/css/ie.css">
  <![endif]-->

第2步,在html文档结尾处加入以下的javascript文件:

<!-- jQuery 1.7.2 or higher -->
  <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
  <!-- Optional, bootstrap javascript library -->
  <script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
  <!--[if lte IE 6]>
  <!-- bsie js 补丁只在IE6中才执行 -->
  <script type="text/javascript" src="js/bootstrap-ie.js"></script>
  <![endif]-->

第3步,根据你的情况,这一步是可选的:

IE6注意:: 对每一个新加载的html片段都要调用 $.bootstrapIE6(el) 函数,其实主要就是指的通过ajax获取到的html内容

/**
 * 让el容器中的的所有元素都能兼容IE6
 */
$.bootstrapIE6(el)

目前在IE6下还不能支持tab控件的嵌套,主要是因为IE6不支持css的子选择器

IE6-7 hack

IE6 hack

_zoom:1;

IE6-7 hack

*zoom:1;
IE6 bug fix tip

hasLayout (clear float):

.container 
  { 
    zoom:1; 
  }

其它能够触发haslayout的css属性:

position:   absolute
  float:      left | right
  display:    inline-block
  width:      except 'auto'
  height:     except 'auto'
  zoom:       except 'normal'
  overflow:   hidden | scroll | auto
  overflow-x/-y: hidden | scroll | auto
  position:   fixed
  min-width:  any value
  max-width:  except 'none'
  min-height: any value
  max-height:  except 'none'
  writing-mode: tb-rl   /* only for MS */

下面列出的css属性能够清除hasLayout:

width:        auto;
  height:       auto;
  max-width:    none;   /* IE7 */
  max-height:   none;   /* IE7 */
  position:     static;
  float:        none;
  overflow:     visible;
  zoom:         normal;
  writing-mode: lr-t;

In one selector, following css will not set hasLayout=false:

.element {
    display:inline-block;
    display:inline;
  }

inline-block:

`.container 
  { 
    zoom:1; 
    display:inline;
  }

透明色:

.element
  {
    border-color:pink/* rarely used color */;
    filter:chroma(color:pink);
  }
  * 注意:在relative定位的容器中包含的absolute元素将会由于filter的缘故而消失

body元素的背景色:

body { /* Faild: Sometime, it will not render whole page by gray color  */
    background-color: gray;
  }
  * html { /* Success! */
    background-color: gray;
  }

IE6-7 ul.dropdown-menu 必须增加以下样式:*width:explicit-width;

/* for example */
  *width:180px;

软件首页 软件文档 软件预告

tags:

上一篇  下一篇

相关:

MySQL分区表原理及使用详解

今天统计数据的时候发现一张表使用了表分区,借此机会记录一下。1. 什么是表分区?表分区,是指根据一定规则

圣诞节,把你的JavaScript代码都装扮成圣诞树吧

用开源项目将你的 JavaScript 变成圣诞树吧!效果的话,可以去看一下我们公司的官网(http://www.souche.co

出现下面九种状况,就表明是时候辞职了。

很多人对目前的工作不满意,你工作开心么?如果有机会你会考虑换一份工作吗?对照文中的情况审视你的工作现

又到年底!是年前找工作好,还是年后呢?

  又到年底了,年底好找工作吗?年前找工作好还是年后找工作好?最近很多同学咨询类似这样的问题,在这里

工作的不开心,想换份工作,想辞职找什么理由好?

  工作的不开心,想换份工作,可又不知道找什么理由辞职?人既不得罪老板,也留得人情在成为一大难题。其

当HR询问你的离职原因时,如何说明自己为什么离开上一份工作?

  有过跳槽经验的人一般都会遇到这样的尴尬:面试新职位时,HR会问自己之前工作的离职原因。之所以尴尬,

上班族必看!如何申请加薪?怎样跟老板提涨工资?

对于上班族来说,最大的幸福莫过于被领导通知涨工资了,可最让大家痛苦的是,涨工资这样的好事,似乎永远也

应届生必看:告诉你面试时该如何和HR谈薪水

对于应届毕业生,在可能的范围下如何进一步争取到更高的待遇呢? 通常的应届生求职,是发一堆简历,然后收到

“吻之树”又来了,你想试试用亲吻点亮一棵圣诞树吗?

圣诞节到了,上海新天地出现了一棵巨型圣诞树,“吻之树(KISS SHANGHAI)”。即使在天气不太好的时候,这

更man的家应该是什么样?

你有没有想过家居产品也有性别之分,纽约一家很有意思的家居电商 TRNK 就这么认为,两位创始人觉得现阶段的

站长推荐: