在进行网站开发过程中,IE是另很多程序员头疼的一个浏览器,他的版本兼容性很难调整,尤其是IE6,IE7,IE8,IE9,IE10这几个版本的区别有很大。现在百度与谷歌都有了一行解决这种兼容性的代码了。我们先来看一下百度的。
1、什么是CSS hack? CSS hack是通过在CSS样式中加入一些特殊的符号,让不同的浏览器识别不同的符号(什么样的浏览器识别什么样的符号是有标准的,CSS hack就是让你记住这个标准),以
css ie6,ie7,ie8 兼容性写法,CSS hack写法 margin-bottom:40px; /*ff的属性*/ margin-bottom:140px\9; /* IE6/7/8的属性 */ color:red\0; /* IE8支持 */ *margin-bottom:450px; /*IE6/7的属性*/ +margin-bottom:450px; _color:#ff0000; /* 只ie6支持 */ #1 {
产品的角度(产品的受众、受众的浏览器比例、效果优先还是基本功能优先) 成本的角度 (有无必要做某件事)
x-ua-compatible 用来指定IE浏览器解析编译页面的model x-ua-compatible 头标签大小写不敏感,必须用在 head 中,必须在除 title 外的其他 meta 之前使用。 1、使用一行代码来指定浏览器使用特定的文档模式。 <meta http-equiv="x-ua-compatible" content="IE=9" > <meta http-equiv="x-ua-compatible" content="IE=8" > <meta http-equiv="x-ua-compatible" content="IE=7" > 2、在一些情况下,我们需要限定浏览器对文档的解析到某一特定版本,或者将浏览器限定到一些旧版本的表现中。可以用如下的方式: <meta http-equiv="x-ua-compatible" content="IE=EmulateIE9" > <meta http-equiv="x-ua-compatible" content="IE=EmulateIE8" > <meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" > 使用这种写法,浏览器或者使用标准模式进行解析,或者使用 IE5 Quirks 模式进行解析。 3、为了测试,我们也可以使用下面的语句指定浏览器按照最高的标准模式解析页面。 <meta http-equiv="x-ua-compatible" content="IE=edge" > 4、多个模式的指定。我们可以用逗号分割多个版本,这种情况下,浏览器会从这个列表中选择一个他所支持的最高版本来使用标准模式进行渲染。如下面的例子,在IE8进行浏览时,将会使用IE7的标准模式进行渲染,因为他本身不支持IE9和IE10。 <meta http-equiv="x-ua-compatible" content="IE=7,9,10" > 参考: http://www.cnblogs.com/cocowool/archive/2013/04/25/3043832.html http://www.cnblogs.com/nidilzhang/archive/2010/01/09/1642887.html http://msdn.microsoft.com/en-us/library/jj676915(v=vs.85).aspx 一行代码解决各种IE兼容问题,IE6,IE7,IE8,IE9,IE10 2012-04-25 16:29:04| 分类: 学习 |字号 订阅 在网站开发中不免因为各种兼容问题苦恼,针对兼容问题,其实IE给出了解决方案Google也给出了解决方案 百度也应用了这种方案去解决IE的兼容问题 百度源代码如下 <!Doctype html> <html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml> <head> <meta http-equiv=Content-Type content=“text/html;charset=utf-8″> <meta http-equiv=X-UA-Compatible content=IE=EmulateIE7> <title>百度一下,你就知道 </title> <script>var wpo={start:new Date*1,pid:109,page:‘superpage’}</script> <meta http-equiv=X-UA-Compatible content=IE=EmulateIE7> 可以打开百度,右键查看源码看下!我们可以看下文件头是否存在这样一行代码! 这句话的意思是强制使用IE7模式来解析网页代码! 在这里送上几种IE使用模式! <meta http-equiv=“X-UA-Compatible” content=“IE=8″> 2. Google Chrome Frame也可以让IE用上Chrome的引擎: <meta http-equiv=“X-UA-Compatible” content=“chrome=1″ /> 3.强制IE8使用IE7模式来解析 <meta http-equiv=“X-UA-Compatible” content=“IE=EmulateIE7″><!– IE7 mode –> //或者 <meta http-equiv=“X-UA-Compatible” content=“IE=7″><!– IE7 mode –> 4.强制IE8使用I
浏览器的兼容性问题,通常是因为不同的浏览器对同一段代码有不同的解析,造成页面显示不统一的情况。
文件兼容性用于定义让IE如何编译你的网页。此文件解释文件兼容性,如何指定你网站的文件兼容性模式以及如何判断一个网页该使用的文件模式。
IE6好像支持这种情况,因为它能匹配链中的最后一个class到使用该class的元素上,然而,它并不能限制一个使用链中所有class的元素。
有多少朋友做过浏览器兼容性测试?怎么做的,效率怎么样,是在不同的机器上下载不同的浏览器进行效果确认?有多少人对浏览器的兼容性测试犯过愁? 本人曾经也对浏览器的兼容性感到头痛,后来到网上找了些资料和工具,虽然未能彻底解决所遇到的问题,不过多少有些帮助,特此分享给大伙,若大伙有什么更好的工具或是经验方法还希望能拿出来晒一晒。 鄙人主要尝试过这几个工具:IETester, SuperPreview,Browsershots,Browser Sandbox。下面分别说一下。 IETester 估计工作
不同的浏览器对CSS的解析结果是不同的,因此会导致相同的CSS输出的页面效果不同,这就需要CSS Hack来解决浏览器局部的兼容性问题。而这个针对不同的浏览器写不同的CSS 代码的过程,就叫CSS Hack。
昨天和朋友聊到了有关浏览器兼容性的问题,在开发中有时的确很让人苦恼,我向他推荐了几款测试浏览器兼容的工具,分享给大伙,有什么更好的工具或是解决方法还希望大家拿出来晒一晒。
1、为什么要用 jQuery DOM API 很难用。我们可以通过document.getElementById等方法获取DOM对象,但是方法名称长,使用不方便,而且功能有限,不能像CSS选择器那样灵活。 存在兼容性问题。比如,实现一些功能要写一些事件处理程序,如果要兼容老浏览器的话,则要进行一层层的封装。 功能太少,不能与时俱静。换句话说,只有等到浏览器更新了或者不需要兼容老浏览器时,才可以使用一些新的语法去选择一些元素,去操作它......。 jQuery 兼容性好。 API 友好。使用起来很方便 功能
最近有用到php的json字符串要转成js对象,以前一直用jq或者eval,又发现了其他的方法,记录下.
属性前缀法是在CSS样式属性名前加上一些只有特定浏览器才能识别的hack前缀,以达到预期的页面展现效果。
关于CSS对各个浏览器兼容已经是老生常谈的问题了, 网络上的教程遍地都是.以下内容没有太多新颖, 纯属个人总结, 希望能对初学者有一定的帮助. 一、CSS HACK 以下两种方法几乎能解决现今所有HACK.
由于不同厂商的浏览器,比如Internet Explorer、Chrome、Mozilla Firefox、Safari等,或者是统一厂商的浏览器的不同版本,比如IE6和IE7,对CSS的解析和认识不完全一样,因此会导致生成的页面效果不一样,得不到我们所需要的页面效果。这个时候,我们就需要针对不同的浏览器,去写不同CSS,让它能够同时兼容不同的浏览器,能在不同的浏览器中,也能得到我们想要的页面效果。
只在IE下生效 只在IE6下生效 只在IE6以上版本生效 IE8以及IE8以下 只在IE8上不生效 非IE浏览器生效
(1)IE6双边距bug: 块属性标签添加了浮动float之后,若在浮动方向上也有margin值,则margin值会加倍。这种问题主要就是会把某些元素挤到了第二行。
所谓的浏览器兼容性问题,是指因为不同的浏览器对同一段代码有不同的解析,造成页面显示效果不统一的情况。在大多数情况下,我们的需求是,无论用户用什么浏览器来查看我们的网站或者登陆我们的系统,都应该是统一的显示效果。所以浏览器的兼容性问题是前端开发人员经常会碰到和必须要解决的问题。
本文总结了div+css布局时常见的IE6兼容性问题及解决方法,包括14个常见问题及相应的解决方法。
综述:虽然说被停止支持,但是不得不说的是,IE6的市场并不会随着支持的停止而立刻消散下去,对于WEB前端开发工程师来说,兼容IE6 兼容各个浏览器,依然是不得不面对的工作。
第一章 一、内联块 display: inline-block; 1、特征: 1.1 块级元素在一行显示 (得到内联元素的属性) 1.2 内联元素支持宽高 (得到块的属性) 1.3 没有宽度的时候,内容撑开宽度 (得到内联元
在Firefox,chrome,opera,safari,ie9,ie8等高级浏览器直接可以用JSON对象的stringify()和parse()方法。 JSON.stringify(obj) 将JSON对象转为字符串。 JSON.parse(string) 将字符串转为JSON对象格式。
CSS对浏览器的兼容性有时让人很头疼,或许当你了解当中的技巧跟原理,就会觉得也不是难事,从网上收集了IE7,6与Fireofx的兼容性处理方法并整理了一下.对于web2.0的过度,请尽量用xhtml格式写代码,而且DOCTYPE 影响 CSS 处理,作为W3C的标准,一定要加 DOCTYPE声名.
CSS Hack是在标准CSS没办法兼容各浏览器显示效果时才会用上的补救方法,在各浏览器厂商解析CSS没有达成一致前,我们只能用这样的方法来完成这样的任务. 我进行前端开发的时候,测试用的浏览器大致有: IE7, IE6, Opera9(文章撰写时版本为9.25 8825), Safari3(文章撰写时版本为3.0.4 523.15), Firefox2(文章撰写时版本为2.0.0.11). 在正常的 selector { property:value; } 的基础上常会根据具体情况为相同元素使用Hack以
浏览器兼容性一直是一个前端开发人员不可避免的大问题,这篇文章主要列举了html、css以及javascript中一些常见的兼容性问题以及对应的解决方案。
一、前言 从IE8开始引入了文档兼容模式的概念,作为开发人员的我们可以在开发人员工具中通过“浏览器模式”和“文档模式”(IE11开始改为“浏览器模式”改成更贴切的“用户代理字符串”)品味一番,它的出现极大地方便了苦逼的前端攻城狮们适配各版本的IE,但jser们也不能完全信任它,因为它只是提供尽可能的文档模式模拟而已。 本篇大部分内容来源于官方解说:http://msdn.microsoft.com/library/cc288
虽然以前就知道浏览器有文档模式,但是一直对他迷迷糊糊。这本书有说道,于是就仔细看看吧。 文档模式有3种, 混杂模式 标准模式 准标准模式 混杂模式是一般的浏览器在开发者没有声明的时候默认使用(不过这种模式在不同的浏览器下表现的差异很大,一般不要用),因为文档模式是在IE5.5出现时引入的,所以混杂模式的作用是让之后得浏览器版本的行为更像IE5.5,而标准模式则是为了让IE的行为更像标准(遵守W3C的标准),最后一种准标准模式,我就呵呵了,看了半天也没理解书上那简短的一句话讲的是什么,但是度娘说准标准模式在I
代码如下: JSON.parse(jsonstr); //可以将json字符串转换成json对象 JSON.stringify(jsonobj); //可以将json对象转换成json对符串
浏览器有着大量不同的版本,不同种类的浏览器的内核也不尽相同,所以不同浏览器对代码的解析会存在差异,这就导致对页面渲染效果不统一的问题。
前言 过去一直听说旧版本IE下很多诡异bug均由一个神秘角色引起的,那就是hasLayout。趁着最近突然发神经打算好好学习CSS,顺便解答多年来的疑惑。 hasLayout到底是何方神圣? hasLayout可以简单看作是IE5.5/6/7中的BFC(Block Formatting Context)。也就是一个元素要么自己对自身内容进行组织和尺寸计算(即可通过width/height来设置自身的宽高),要么由其containing block来组织和尺寸计算。而IFC(即没有拥有布局)而言,则是元素无法
前端布局非常重要的一环就是页面框架的搭建,也是最基础的一环。在页面框架的搭建之中,又有居中布局、多列布局以及全局布局,今天我们就来总结总结前端干货中的CSS布局。 水平居中 1)使用inline-b
前端是一个苦逼的职业,不仅因为技术更新快,而且要会的东西实在太多了,更让人头疼的是,还要面临各种适配、兼容性问题。
IETester是一款免费(兼具个人和专业用途)的WebBrowser,它允许您在 Windows 8桌面,Windows 7,Vista 和 XP上使用IE11,IE10,IE9,IE8,IE7,IE6 和 IE5.5 的渲染和JavaScript引擎,以及在同一过程中安装的IE。
关于CSS对各个浏览器兼容已经是老生常谈的问题了, 网络上的教程遍地都是. 以下内容没有太多新颖, 纯属个人总结, 希望能对初学者有一定的帮助. 一、CSS HACK 以下两种方法几乎能解决现今所有HACK. 1, !important 随着IE7对!important的支持, !important 方法现在只针对IE6的HACK. (注意写法.记得该声明位置需要提前.) <style> #wrapper { width: 100px!important; /* IE7+FF */ wid
css兼容性问题 1、标签,不加样式控制的情况下,各自的margin 和padding差异较大。 解决方案:css里 *{margin:0;padding:0;} 备注:这个是最常见的也是最易解决的一个浏览器兼容性问题,几乎所有的css文件开头都会用通配符*来设置各个标签的内外补丁是0。 2、块属性标签float后,又有横行的margin情况下,在ie6显示margin比设置的大。 问题症状:常见症状是ie6中后面的一块被顶到下一行。 解决方案:在float的标签样
它表示所附加的声明具有最高优先级的意思,被浏览器优先显示(ie6不识别此写法) 语法:选择符{属性:属性值!important;}
现在市面上浏览器无外乎有这么几种:微软的IE、Mozilla的火狐、苹果Safari、谷歌Chrome和Opera等。其他诸如遨游、世界之窗、360安全卫士等都是基于IE内核的浏览器,少了IE内核它们全部没用,因此严格来说并不是真正意义上的浏览器。
先来说说什么是浏览器兼容? 对于很多初学者来说先要知道目前主流的浏览器有IE6、IE8、Mozilla、 FireFox、Opera、Safari、Chrome、Netscape等。这些主流的浏览器主要由四个内核程序来服务: Trident内(IE,MaxThon,TT,The World,360,搜狗浏览器等) Gecko内核(Netscape6及以上版本,FF,MozillaSuite/SeaMonkey等) Presto内核(Opera7及以上 ) Webkit内核(Safari,Chrome) 由于
一、前言 由于本人英语能力有限,译本内容难免有误,望各位指正! 本译文不含附录部分,请知悉。 二、译文内容 为了让用户正常访问遵循Web标准的网站和90年代后期的非标准网站,当前的浏览器都内置了多种引擎模式。本文将解释这些模式和它们触发的原理。 本文概要(没耐性的同学看完这个就可以闪了!) 本文结论:以<!DOCTYPE html>作为你们的HTML文档(http头的mime为text/http的
IE6 hack _background-color:#CDCDCD; /* ie 6*/ IE7 hack *background-color:#dddd00; /* ie 7*/ IE8 hack background-color:red \0; /* ie 8/9*/ IE9 hack background-color:blue \9\0; 浏览器优先级别:FF<IE7<IE6,CSS hack书写顺序一般为FF IE7 IE6 以: " #demo {width:100px;}
我们在开发的时候会明确项目要兼容哪些浏览器的最低版本,我之前的项目要求兼容IE8.0以上的版本,Chrome 48以上,FireFox 44以上。有了这些最基本的要求,在开发中就是要考虑到CSS样式和JavaScript的在这些浏览器的兼容性了 一、html部分
Microsoft Expression Web SuperPreview for Internet Explorer 是微软发布的一款免费软件,它可以让我们在各个版本 IE 浏览器下调试网站,使得网站在各个版本 IE 浏览器下兼容。通过 SuperPreview For IE,我们可以迅速升级你的网站到 IE8,并且同时兼容 IE6 和 IE7。 SuperPreview For IE 可以展示网站在 IE6, 7, 8 各个版本的 IE 浏览器中渲染情况,该软件还提供尺子,平移,变焦等工具去准确区分布局上的不同。如下图就是我爱水煮鱼在 IE6 和 IE8 上面的比较情况:
在我们的日常生活中,时常遇到这么一种情况,当我们在点击一个链接、关闭页面、表单提交时等情况,会提示我们是否确认该操作等信息。
前端布局非常重要的一环就是页面框架的搭建,也是最基础的一环。在页面框架的搭建之中,又有居中布局、多列布局以及全局布局,今天我们就来总结总结前端干货中的CSS布局。
PNG32的alpha透明效果在IE6下会出现bug,出现灰色背景。而目前的解决方案就是 IE提供的滤镜。需要注意的是滤镜并不是对原图片进行修改,而是对相应的html元素进行 修改。所以在一个html中的多处使用alpha滤镜,那么性能的损耗将会累加。 现总结使用滤镜的缺点: 1,IE6下使用滤镜,那么无法对该PNG图片进行定位。可以通过其他解决方案完成。这篇 文章提到了两种解决方案,分别是硬编码和clip方案。 2,使用滤镜会冻结IE6的渐进渲染。渲染往往是从css下载完毕开始进行,然而对于使用滤
最近几天辛辛苦苦的修改了这个比较中意的模板,然后就需要考虑各个浏览器兼容性的问题了,目前大多数都是IE8,少部分还存在ie7、ie6等浏览器,ie浏览器绝对是一个噩梦,美丽的网站会被撕得粉碎,疼的你是不要不要的。。。
5 月 16 日凌晨,微软 Edge 浏览器官方微博发博表示,微软 1995 年推出的 IE 浏览器将于 2022 年 6 月 16 日正式退役,27 年的旅程走到了尽头,之后将由 Edge 浏览器接棒继续提供服务。
领取专属 10元无门槛券
手把手带您无忧上云