没有样式就是最好的样式

Archive for January, 2005


关于 object 标签

Jan 9, 2005 Author: | Filed under: Uncategorized

前几日见到 w3g 新标准草案,将会用 object 来取代 img 标签,赶紧研究一下这个标签。

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

IE中看下面这几个(还必须指定高宽)

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

指定错误的类型,FF可以显示,IE则显示注释文字

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

关于iframe与 object的区别

object也可以象 iframe(Inline Frame)那样来嵌入页面

以下为引用内容:

13.5 Notes on embedded documents

Sometimes, rather than linking to a document, an author may want to embed it directly into a primary HTML document. Authors may use either the IFRAME element or the OBJECT element for this purpose, but the elements differ in some ways. Not only do the two elements have different content models, the IFRAME element may be a target frame (see the section on specifying target frame information for details) and may be “selected” by a user agent as the focus for printing, viewing HTML source, etc. User agents may render selected frames elements in ways that distinguish them from unselected frames (e.g., by drawing a border around the selected frame).

An embedded document is entirely independent of the document in which it is embedded. For instance, relative URIs within the embedded document resolve according to the base URI of the embedded document, not that of the main document. An embedded document is only rendered within another document (e.g., in a subwindow); it remains otherwise independent.

For instance, the following line embeds the contents of embed_me.html at the location where the OBJECT definition occurs.

…text before…

Warning: embed_me.html could not be embedded.

…text after…

Recall that the contents of OBJECT must only be rendered if the file specified by the data attribute cannot be loaded.

The behavior of a user agent in cases where a file includes itself is not defined.


object方式引用图片测试

你可以切换不同浏览器看一下,不同或者不完整参数的object在各个浏览器下的表现,当然你也可以直接在上面代码框修改运行。

http://www.student.oulu.fi/%7esairwas/object-test/images/

还有其它的一些测试代码,不错,值得看一下

http://www.student.oulu.fi/%7esairwas/object-test/

虽然这个标签现在还不流行,但以后一定会火的。

参考资料:

http://www.htmlhelp.com/reference/html40/special/object.html

http://www.w3.org/TR/REC-html40/struct/objects.html

[Edit on 2005-1-9 11:10:56 By guoshuang]

为什么浏览器显示了源代码?

Jan 8, 2005 Author: | Filed under: Uncategorized

因为错误的MIME类型。IE会自动判断,但其它浏览器需要服务器端明确指出。

以下为引用内容:

Why does the browser show my plain HTML source?

If Microsoft Internet Explorer displays your document normally, but other browsers display your plain HTML source, then most likely your web server is sending the document with the MIME type “text/plain”. Your web server needs to be configured to send that filename with the MIME type “text/html”. Often, using the filename extension “.html” or “.htm” is all that is necessary.

See the answer to “Why did my link to a … file download a bunch of characters instead?” for more details.

http://www.htmlhelp.com/faq/html/media.html#garbled-media

If you are seeing this behavior while viewing your HTML documents on your local Windows filesystem, then your text editor may have added a “.txt” filename extension automatically. You should rename filename.html.txt to filename.html so that Windows will treat the file as an HTML document.


以下为引用内容:

Content Type Description

Application/msword Microsoft Word Document

application/octet-stream Unclassified binary data (often used for compressed file or executable)

application/pdf PDF Document

application/wordperfect6.0 WordPerfect 6.0 Document

application/zip ZIP archive

audio/x-wav WAV audio format

audio/midi MIDI audio format

audio/x-pn-realaudio RealAudio

image/gif GIF image format

image/jpeg JPEG image format

image/png PNG image format

text/css CSS style sheet

text/html HTML document

text/plain Plain text

video/mpeg MPEG video format

video/quicktime QuickTime video format

video/x-msvideo AVI video format


原文在:

http://www.htmlhelp.com/faq/html/design.html#source-shown

[Edit on 2005-1-10 10:51:14 By guoshuang]

页面包含的方法

Jan 8, 2005 Author: | Filed under: Uncategorized
以下为引用内容:

How do I include one file in another?

HTML itself offers no way to seamlessly incorporate the content of one file into another.

True dynamic inclusion of one HTML document (even in a different “charset”) into another is offered by the OBJECT element, but due to shortcomings of browser versions in current use, it seems unwise to rely on this yet for essential content. The same can be said for IFRAME.

Two popular ways of including the contents of one file seamlessly into another for the WWW are preprocessing and server-side inclusion. A preprocessor converts its source into a plain HTML document that you publish on your server. In contrast, documents that use server-side inclusion are processed every time the document is retrieved from the server.

Preprocessing techniques include the C preprocessor and other generic text manipulation methods, and several HTML-specific processors. There is a nice annotated list of HTML preprocessors at .

Beware of making your “source code” non-portable. Also, the HTML can only be validated after preprocessing, so the typical cycle “Edit, Check, Upload” becomes “Edit, Preprocess, Check, Upload” (here, “Check” includes whatever steps you use to preview your pages: validation, linting, management walk-through etc.; and “upload” means whatever you do to finally publish your new pages to the web server).

A much more powerful and versatile preprocessing technique is to use an SGML processor (such as the SP package) to generate your HTML; this can be self-validating.

Examples of server-side inclusion are Server Side Includes (SSI, supported by Apache, NCSA, and other web servers), and Microsoft’s Active Server Pages (ASP, supported by MS IIS). Processing occurs at the time the documents are actually retrieved. A typical inclusion looks like

However, be sure to consult your own server’s documentation, as the details vary somewhat between implementations. The whole directive gets replaced by the contents of the specified file.

Using server-side inclusion (a potentially powerful tool) merely as a way to insert static files such as standard header/footers has implications for perceived access speed and for server load, and is better avoided on heavily loaded servers. If you use it in this way, consider making the result cacheable (e.g., via “XBitHack full” on Apache; setting properties of the “Response” object in ASP). Details are beyond the scope of this FAQ but you may find this useful: http ://www.mnot.net/cache_docs/

Proper HTML validation of server-side inclusion is only possible after server-side processing is done (e.g. by using an on-line validator that retrieves the document from the server).

Another approach is to create a database-backed site, as described in “Philip and Alex’s Guide to Web Publishing” at . A simple change to the database template instantly changes the whole site.

Finally, note that if the included file contains arbitrary plain text, then some provision must be made to convert the characters “&” and “<" (in the plain text file) to the entities "&" and "<" (in the HTML document).


原文:

http://www.htmlhelp.com/faq/html/design.html#include-file

[Edit on 2005-1-8 10:18:29 By guoshuang]

不缓存页面的做法

Jan 8, 2005 Author: | Filed under: Uncategorized
以下为引用内容:

How do I stop my page from being cached?

Browsers cache web documents; they store local copies of documents to speed up repeated references to documents that haven’t changed. Also, many browsers are configured to use public proxy caches, which serve many users (e.g., all customers of an ISP, or all employees behind a corporate firewall). To effectively control how your documents are cached you must configure your server to send appropriate HTTP headers.

The Expires header is understood by virtually all caches. The cached document will be retrieved again automatically once it has expired. The Expires header must contain an HTTP date, which must be Greenwich Mean Time (GMT), not local time.

HTTP 1.1 introduced the Cache-Control header, which provides more flexibility for telling caches how to handle the document. For more information, see the HTTP 1.1 draft (see ).

The configuration details vary from server to server, so check your server documentation. For example, if your server is Apache, see for information about setting the Expires header, and for information about setting other headers.

The Pragma header is generally ineffective because its meaning is not standardized and few caches honor it. Using elements in HTML documents is also generally ineffective; some browsers may honor such markup, but other caches ignore it completely.

Further discussion can be found at .


原文:

http://www.htmlhelp.com/faq/html/publish.html#no-cache

[Edit on 2005-1-8 9:40:24 By guoshuang]

如何在 title 和 alt标签中使用引号

Jan 7, 2005 Author: | Filed under: Uncategorized

转义为 ",或者用单引号包含双引号,或者用咱们中国人的全角标点 “” :)

但老版本浏览器处理起来可能有错误,最好是尽量不要用引号或者双引号在外面 “aaaa’bb’ccc”

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

[Edit on 2005-1-7 21:00:36 By guoshuang]

css 杂记若干

Jan 6, 2005 Author: | Filed under: Uncategorized

说明:如果用IE类浏览器很多效果看不到!请切换 mozilla类(gecko引擎)如firefox 来对比察看运行结果.以后的CSS javascript 默认都为 firefox 书写,不再赘述…

DIV.warning 等同于 DIV[class~="warning"]

E[lang|="en"] 所有英语类语言,包括”en”, “en-US”, 和”en-cockney”

Adjacent sibling selectors(相邻标签选择器)

p+div 表示 p 后面紧跟的那个 div

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

CSS 引用方式

1.

2. @media

3.

paragraph

paragraph

paragraph

paragraph

paragraph

运行代码 [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]

[Edit on 2005-1-7 15:37:33 By guoshuang]
[Edit on 2005-3-15 17:25:39 By guoshuang]