August 20, 2009
在Web前端开发中,我们经常用会尝试做一些透明效果。最常见的就是,利用背景透明的PNG图片来做透明效果。目前,IE8,Firefox,Chrome对PNG的支持都很好,唯有可恶的IE6,居然把背景透明的PNG图片上显示一层淡淡的底色!无奈,据说国内还有至少50%的网民在用IE6,想做一个大部分人都能用的网站,不改都不行。
google一下,发现了一堆解决方案,看来这问题确实是老生常谈了。不过,我将最简单的,通过css方法来做到透明的代码写在这里:
#logo {
background: url(/images/pinpaibar.png) 0 0 no-repeat;
position: absolute;
top: 25px;
left: 0px;
/*以上是正常的css,下面是专门为IE6准备的css,别的浏览器不认识 */
_background:none;
_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=’true’, sizingMethod=’scale’, src="/images/pinpaibar.png");
}
将图片地址换成你自己的,就可以了,这个方法,是通过背景图片的方法来显示透明图片,其他的别的方法需要使用Javascript什么的,费劲的很。如果可以的话,建议使用以上方法来做透明。
Filed under:
Web开发 by Yang Bo
August 19, 2009
前一阵子经常接触XML,其中看到DOCTYPE元素中有两个属性:publicId和systemId。对其意义不是很理解,今天偶然看到了两篇文档,对二者的含义作了详细的解释,甚好,记录在此:
systemId: 外部资源(多半是DTD)的URI,比如本地文件file:///usr/share/dtd/somefile.dtd或者网络某个地址的文件http://www.w3.org/somefile.dtd;
publicId: systemId已经可以表示任何位置的外部DTD资源了,但是它是直接指向相应的资源,publicId的作用在于其间接性。publicID就相当于一个名字,这个名字代表了一个外部资源。比如,我们规定”W3C HTML 4.01″这个字符串对应”http://www.w3.org/somedir/somefile.dtd”这个资源。那么,publicID=”W3C HTML 4.01″ 和 systemID=”http://www.w3.org/somedir/somefile.dtd”是一样的,二者都引用了http://www.w3.org/somedir/somefile.dtd作为该文档的外部DTD。
总之,二者都是对外部资源的引用,用以知名引用资源的地址,systemID直接引用资源,publicID间接定位外部资源。具体细节,请参见下面两个链接:
Use of XML systemId and publicID
Detail of systemId/publicId and catalog file
Filed under:
XML by Yang Bo
August 17, 2009
Recently, I am working on the implementation of DOM for an Open Source browser Netsurf, so I need to read the DOM specs a lot. And I found an interesting type of interfaces in the spec, that is “live collection”. Take the Core module for example:
The NodeList interface provides the abstraction of an ordered collection [...]
Filed under:
DOM by Yang Bo
August 16, 2009
最近一直在为开源浏览器Netsurf写DOM实现,从DOM Core写到DOM HTML,发现其中有一个Live Collection的概念经常在DOM spec中出现。以Core模块为例:
The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.
和
NamedNodeMap objects in the DOM are live.
标准中也明确给出了live的定义:
NodeListand NamedNodeMap objects in the DOM are live; that is, changes to the underlying document structure are reflected [...]
Filed under:
DOM by Yang Bo