CSS3 @font-face的url要添加?#iefix的原因

转至:https://github.com/CSSLint/csslint/wiki/Bulletproof-font-face

When using @font-face to declare multiple font types for cross browser compatibility, you can see 404‘s in old versions of IE due to a bug in the way that IE parses the font declarations. For example, this syntax:

@font-face {
    font-family: ‘MyFontFamily‘;
    src: url(‘myfont-webfont.eot‘) format(‘embedded-opentype‘),
        url(‘myfont-webfont.woff‘) format(‘woff‘),
        url(‘myfont-webfont.ttf‘)  format(‘truetype‘),
        url(‘myfont-webfont.svg#svgFontName‘) format(‘svg‘);
}

Will cause a 404 in IE 6, 7, and 8. The fix is to add a question mark after the first font URL, so IE sees the rest of the property value as a query string. This is a correct example:

@font-face {
    font-family: ‘MyFontFamily‘;
    src: url(‘myfont-webfont.eot?#iefix‘) format(‘embedded-opentype‘),
        url(‘myfont-webfont.woff‘) format(‘woff‘),
        url(‘myfont-webfont.ttf‘)  format(‘truetype‘),
        url(‘myfont-webfont.svg#svgFontName‘) format(‘svg‘);
}

Rule Details

Rule ID: bulletproof-font-face

This rule is aimed at preventing 404 errors in Internet Explorer 8 and earlier due to a bug in how web font URLs are parsed.

The following patterns are considered warnings:

@font-face {
    font-family: ‘MyFontFamily‘;

    /* First web font is missing query string */
    src: url(‘myfont-webfont.eot‘) format(‘embedded-opentype‘),
        url(‘myfont-webfont.woff‘) format(‘woff‘),
        url(‘myfont-webfont.ttf‘)  format(‘truetype‘),
        url(‘myfont-webfont.svg#svgFontName‘) format(‘svg‘);
}

The following patterns are considered okay and do not cause warnings:

@font-face {
    font-family: ‘MyFontFamily‘;
    src: url(‘myfont-webfont.eot?#iefix‘) format(‘embedded-opentype‘),
        url(‘myfont-webfont.woff‘) format(‘woff‘),
        url(‘myfont-webfont.ttf‘)  format(‘truetype‘),
        url(‘myfont-webfont.svg#svgFontName‘) format(‘svg‘);
}

This rule requires that the first font declared is a .eot file with a query string, but doesn‘t check the order of the remaining fonts (which is irrelevant, assuming you have the .eot file first).

This rule was added in v0.9.10.

CSS3 @font-face的url要添加?#iefix的原因

时间: 2024-08-27 13:19:33

CSS3 @font-face的url要添加?#iefix的原因的相关文章

CSS3 icon font完全指南(CSS3 font 会取代icon图标)

为什么要将icon做成字体? 在很多网站项目中,我们常常会用到各种透明小图标,然后网站要兼容各个浏览器,也可能会有多个尺寸,甚至还要考虑换肤等需求.那么我们就要将这些小图标输出为多种尺寸.颜色和文件格式,比如png8 alpha透明或者png8 index透明等. 比如,twitter用到的各种小icon: 这种情况下,使用字体来实现图标就有很多优势: 字体文件小,一般20-50kb: 容易编辑和维护,尺寸和颜色可以用css来控制: 透明完全兼容IE6: 如何将icon变成字体? 最关键的是要将

使用CSS3对页面中的文字添加彩色边框

<!doctype html> <html> <head> <meta charset="utf-8"> <title>使用CSS3对页面中的文字添加彩色边框</title> <style>  #boarder{  border:solid 5px blue;  border-radius:20px;  -moz-border-radius:20px;  padding:20px;  width:180

CSS3使用Animation为同一个元素添加多个动画效果

本篇文章由:http://xinpure.com/css3-animation-for-the-same-element-multiple-animation-effects/ CSS3 Animation 并未提供 给一个元素同时添加多个动画效果的方法,就是说一个元素,只能给它定义一个动画效果,不能同时定义. 需求说明 比如说,我想实现一个这样的动画效果: 一颗星星从上往下滑落,当滑落到指定位置时开始闪烁 这里就用到了两个动画效果: 1. 从上往下滑落 (单次动画) 2. 闪烁 (循环动画)

URL scheme添加以及查找方式

2.1.1  添加URL Types URL Scheme是通过系统找到并跳转对应app的一类设置,通过向项目中的info.plist文件中加入URL types可使用第三方平台所注册的appkey信息向系统注册你的app,当跳转到第三方应用授权或分享后,可直接跳转回你的app. 添加URL Types有如下几处,都可进行设置 通过工程设置面板 通过info.plist文件编辑 直接编辑info.plist中XML代码 2.1.2  配置第三方平台URL Scheme 未列出则不需设置 平台 格

url后面添加参数,注意&amp;?的添加方式

// 添加参数&key=value 直接输出url function insertParam(key, value) { key = encodeURI(key); value = encodeURI(value); var kvp = document.location.search.substr(1).split('&'); var i=kvp.length; var x; while(i--) { x = kvp[i].split('='); if (x[0]==key) { x[1

flask url转换器,添加另类的url

import urllib from flask import Flask from werkzeug.routing import BaseConverter app = Flask(__name__) class ListConverter(BaseConverter): def __init__(self, url_map, separator="+"): super(ListConverter, self).__init__(url_map) self.separator =

单电源运放添加偏置电压的原因

运放的特点是输出幅值不能超过电源电压的压差,对于传统单电源运放,如LM358,输出电压幅值不能达到电源电压上下限. 单电源运放工作时只能放大对地为正(同向输入)或为负(反向输入)的直流电压,若输入为对地的交流信号时,则只能放大正半波或负半波,另一半波会因为截止而产生严重失真. 为了得到不失真的交流放大信号,需要在输入端叠加一个偏置电压,一般为1/2 VCC. 若在运放的一端输入对地偏置1/2 VCC的信号,另一端接地,则在反向输入的情况下:理论输出为负,但在此情况下单电源运放的下限接近0V,因此

添加Net4CollectionTypeFactory的原因

.NET4.0已经实现了该功能 http://jahav.com/blog/nhibernate-using-net-4-iset/ NHibernate using .NET 4 ISet 0 Comments NHibernate 4.0 (released in 2014-08-17) has brought us support for .NET 4 ISet<> collections, thus freeing us from the tyranny of the Iesi pac

CSS Sprites+CSS3 Icon Font

CSS Sprites+CSS3 Icon Font 先马上等有空一定看看转载于http://www.cnblogs.com/jingwhale/p/4280073.html CSS Sprites在国内很多人叫CSS精灵,是一种网页图片应用处理方式.它允许你将一个页面涉及到的所有零星图片都包含到一张大图中去,这样一来,当访问该页面时,载入的图片就不会像以前那样一幅一幅地慢慢显示出来了.根据具体图标在大图上的位置,给背景定位. CSS Sprites加速的关键,不是降低质量,而是减少个数. 做成