IE5 到 IE8 的 CSS 兼容列表

IE 官方提供的 IE5 到 IE8 的 CSS 兼容列表:《CSS Compatibility and Internet Explorer》(小马 最新提供的信息)
很好的参考资料,可以方便帮助大家了解和熟悉各 IE 浏览器之间 CSS 的兼容情况。
个人最近一直对 MS 另眼相看,从 IE 8 Beta 1 发布的第一天起,至少我们看到 MS 的态度,积极开放,结果虽不太如人意,但至少 MS 跨出了重要的一步,放下了一向高傲的姿态 。

... 4 条评论 »

页面中 CSS 加载方式的优化

1、应该将 CSS 放置于结构的上方(一般放置于 head 元素内)。CSS 是解释型语言,Firefox 和 IE 在等待 CSS 传输完成之前不会渲染任何东西。只有将 CSS 前置,才可在浏览器解析结构时,对页面进行渲染。
This causes the blank white screen problem. The page is totally blank until the stylesheet at the bottom is downloaded, on the order of 6-10 seconds for this page. The browser is waiting for the stylesheet to be loaded before it renders anything [...]

... 16 条评论 »

提高Web页面的性能(二)

最近 Yahoo! Exceptional Performance 在 《优化网站性能的 14 条规则》的基础上又增加了 20 条新的规则。

1. 尽早清除缓冲区
[server]

2. AJAX 请求使用“GET”方法
[server]

3. 延迟加载组件
[content]

4. 预加载组件
[content]

5. 减少 DOM 元素的数量
[content]

6. 跨域分离组件
[content]

7. 减少 iframes 的数量
[content]

8. 不出现 404
[content]

9. 减小 cookie 的体积
[cookie]

10. 为组件使用 cookie-free 的域名
[cookie]

11.减少访问 DOM 的次数
[javascript]

12. 开发巧妙的事件处理程序
[javascript]

13. 优先选择使用 <link> 而非 @import
[css]

14. 避免使用 filters
[css]

15. 优化图片
[images]

16. 优化 CSS sprites
[images]

17. 不要在 HTML 中缩放图片
[images... 4 条评论 »

提高Web页面的性能(一)

优化网站性能的14条规则(更新)

1. 尽可能的减少 HTTP 的请求数
[content]

2. 使用 CDN(Content Delivery Network)
[server]

3. 添加 Expires 头(或者 Cache-control )
[server]

4. Gzip 组件
[server]

5. 将 CSS 样式放在页面的上方
[css]

6. 将脚本移动到底部(包括内联的)
[javascript]

7. 避免使用 CSS 中的 Expressions
[css]

8. 将 JavaScript 和 CSS 独立成外部文件
[javascript] [css]

9. 减少 DNS 查询
[content]

10. 压缩 JavaScript 和 CSS (包括内联的)
[javascript] [css]

11. 避免重定向
[server]

12. 移除重复的脚本
[javascript]

13. 配置实体标签(ETags)
[css]

14. 使 AJAX 缓存
[content]

详细请看:Best Practices for Speeding Up [...]

... 9 条评论 »

YUI: Effects Widgets

YAHOO.widget.Effects 基于 YUI 实现的 Effects 库,记录一下。
http://blog.davglass.com/files/yui/effects/
用这个库可以很好的改善网站某些视觉效果,当然使用适当为上,画龙点睛即可。

... 4 条评论 »

URL 优化的一个技巧

今天 承志 看到的,感觉比较有收获,分享一下:
When generating hyperlinks, always include a trailing slash if possible. For instance, navigating to http://msdn.microsoft.com/ie takes one more roundtrip than http://msdn.microsoft.com/ie/. When the browser navigates to the /ie url, the server merely sends down a 301 to the /ie/ url. Both links work, but the second version is faster.
也就是说,在地址栏中发送 URL:http://msdn.microsoft.com/ie ,服务器将会产生一个 301 转向至 [...]

... 8 条评论 »

HTML5中 b 和 i 标签将语义化

b 和 i 标签在现在的 Web 标准潜规则中是不推荐使用,甚至是反对使用的,因为认为他们只是“表现”粗体和斜体,而没有任何“语义”。更多的用 strong 和 em 标签代替。
而在新的 HTML5 工作草案 中对于 b 和 i 标签是这样定义的:
The b element now represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of [...]

... 6 条评论 »

IE8 beta1 中的 CSS 属性

IE8 (下文中的 IE8 暂时仅代表IE8 beta1) 中增加了 CSS3 中的子串匹配的属性选择器(substring matching attribute selectors),具体规则与正则中的匹配很相似:

E[att^='val'] //子串以’val’ 开始
E[att$='val'] //子串以’val’ 结束
E[att*='val'] //子串中包含’val’

IE8 支持绝大多数基本的 CSS2.1 选择器:

:before and :after 被支持,只支持文本,不支持图片,但还存在bug 。
:focus 被支持。
display: inline-block 被支持(只能用于内联元素)。
display: table 被支持。
list-style 完全被支持,包括值 upper-greek (此值其他浏览器均未支持)。
outline 被支持。
border-collapse, border-spacing 和 caption-side 被支持。
white-space 完全被支持。
box-sizing 被支持,不过使用的是私有属性 -ms-box-sizing 。

不支持的包括但不限于... 13 条评论 »

背投广告代码的完善

对于背投广告的原理来说并没有什么难度,无非打开的窗口失去焦点(blur),而原来页面得到焦点(focus)。但对于流行的浏览器来说,如果非用户行为的弹出窗口(即 onload 时,直接window.open ),会被浏览器默认拦截。
背投广告,既然被称为广告,那如何才能让广告主的钱花得实在,花得乐意呢?
我们可以增加判断,如果该弹出窗口被浏览器拦截,则只要用户点击页面就触发 window.open 事件,这样一般不会拦截,浏览器会认为这是用户的默认行为。
代码可编写如下:
var $E = YAHOO.util.Event;
var adPopup;
var popAd = function(sURL,sName,sFeatures,bReplace) {
if (adPopup) return;
if(sName == undefined) {
sName = ‘_blank’;
};
if(sFeatures == undefined) {
sFeatures = ”;
};
if(bReplace == undefined) {
bReplace = fal... 3 条评论 »

通过 Dom 方法提高 innerHTML 性能

function replaceHtml(el, html) {
var oldEl = typeof el === “string” ? document.getElementById(el) : el;
/*@cc_on // 原始的 innerHTML 在 IE 中的性能好一点
oldEl.innerHTML = html;
return oldEl;
@*/
var [...]

... 5 条评论 »