以身作则? [英] Coding by example?

查看:81
本文介绍了以身作则?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从他的CSS Play网站下载了Stu Nicholl的卷轴库,
http://www.cssplay.co.uk/menu/scroll_gallery.html - 保存为网页

完成查看代码。这对我来说是非常有吸引力的照片

画廊设计。

我将它剥离到裸骨,使用了我的一些图像和

缩略图,需要调整一些元素的大小。它看起来很好,但是在IE浏览器中,图像向右移动了250px,这就是我现在想要解决的问题。但是这个消息不是什么。


我的第一次下载是在Firefox 1.5.0.1中,保存为网页完成。

代码看起来最专业,xhtml doctype和所有。


<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.1 // EN" ;

" http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

< html xmlns =" http: //www.w3.org/1999/xhtml" xml:lang =" en">


因为我对IE显示器感到困扰,我以为我会看代码

Internet Explorer 6.0保存。

给我一个启示!再次,相同的URI保存为网页完成。


<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.01 Transitional // EN"

http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">

< HTML xml:lang =" en" xmlns =" http://www.w3.org/1999/xhtml">


代码看起来像猪的早餐 - 上下混合

的情况下,并没有使用明确的属性,


border:1px solid #fff;

成为: -

BORDER-TOP:1px solid #fff;

BORDER-LEFT:1px solid #fff;

BORDER-BOTTOM:1px solid #fff;

BORDER-RIGHT:1px solid #fff;

等等。


如果我将页面保存为网页,仅限HTML ,在IE中,它看起来很像Firefox生成的网页完整代码,包括xhtml doc类型。


我想我到底要做什么说的是,如果你想通过以下好的例子来学习如何编码,请小心使用什么浏览器

你下载!


虽然不同的doc类型有点令人担忧 - 但是我不知道

还不够,担心太多了。我会尽量坚持使用

html。

Phil

(出于教学目的,Stu Nicholls有一些CSS网页

< head>)

I down loaded Stu Nicholl''s scroll gallery from his CSS Play site,
http://www.cssplay.co.uk/menu/scroll_gallery.html - saved as Web Page
Complete to look at the code. It''s a very attractive (to me) photo
gallery design.
I stripped it down to the "bare bones", used some of my images and
thumbnails, which entailed resizing some elements. It looked good in
Firefox, but in IE the images are shifted 250px to the right, which
problem I''m trying to resolve at the present. But that''s not
what this message is about.

My first down load was in Firefox 1.5.0.1, saved as Web Page Complete.
The code looked most professional, xhtml doctype and all.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

As I''m troubled by the IE display, I thought I''d look at the code
Internet Explorer 6.0 saves.
Quite a revelation to me! Once again, same URI saved as Web Page Complete.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">

And what a pig''s breakfast the code looks - a mixture of upper and lower
case, and no use of abreviated attributes,

border: 1px solid #fff;
becomes :-
BORDER-TOP: 1px solid #fff;
BORDER-LEFT: 1px solid #fff;
BORDER-BOTTOM: 1px solid #fff;
BORDER-RIGHT: 1px solid #fff;
and so on.

If I save the page as Web Page, HTML Only, in IE it looks quite like the
Web Page Complete code produced by Firefox, including the xhtml doc type.

I suppose what I am getting around to saying is, that if you want to
learn how to code by following good examples, be carefull what browser
you down load with!

The different doc types is a bit worrying though - but I don''t know
enough about them yet, to worry too much. I''ll try and stay with strict
html.
Phil
(for tutorial purposes, Stu Nicholls has some of the CSS in the web page
<head>)

推荐答案

Phil Kempster写道:
Phil Kempster wrote:
html。

The different doc types is a bit worrying though - but I don''t know
enough about them yet, to worry too much. I''ll try and stay with strict
html.



AIUI,IE并没有真正将XHTML视为XHTML。而是它恢复到
怪癖模式并将代码视为HTML Transitional。


-

jmm(连字符)列表( at)sohnen-moe(dot)com

(删除.AXSPAMGN电子邮件)


AIUI, IE does not really treat XHTML as XHTML. Rather it reverts to
quirks mode and treats the code as HTML Transitional.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)


2006年3月20日星期一,Jim Moe写道:
On Mon, 20 Mar 2006, Jim Moe wrote:
AIUI,IE并没有真正将XHTML视为XHTML。


IE根本不支持真正的XHTML。好吧,我确实设法配置

一个IE安装使用Mozilla作为其帮助应用程序 for

打开真正的XHTML内容类型(application / xhtml + xml),而不是

愚蠢地提供下载它。


如果XHTML是以text / html格式发布的,那么IE就会把它作为HTML来处理它。

。由于IE与大多数其他浏览器一样,具有故意的错误

,这个魔术行为取决于它,它给出了工作所需的印象

。 (根据附录C的规定,即)。

而是恢复为怪癖模式


不一定。有关详细信息,请参阅常用参考资料。


将<?xml ... thingy插入头部肯定会将IE引入

怪癖模式,但是<?xml ... thingy在某些

条件下是可选的,那些瞄准基于标准的解释

CSS的人建议将其关闭,为此原因。
并将代码视为HTML Transitional。
AIUI, IE does not really treat XHTML as XHTML.
IE doesn''t support real XHTML at all. Well, I did manage to configure
one IE installation to use Mozilla as its "helper application" for
opening real XHTML content-type (application/xhtml+xml), instead of
dumbly offering to download it.

If XHTML is delivered as text/html, then IE has a stab at treating it
as HTML. Since IE, like most other browsers, has the deliberate bug
on which this conjuring act depends, it gives the desired impression
of "working" (subject to the provisions of Appendix C, that is).
Rather it reverts to quirks mode
Not necessarily. See the usual references for details.

Inserting the <?xml... thingy at the head will sure throw IE into
quirks mode, but the <?xml... thingy is optional under certain
conditions, and those who aim for standards-based interpretation of
CSS are advised to leave it off, for that reason.
and treats the code as HTML Transitional.




MSIE将所有HTML视为标签汤。它没有W3C的真正概念

" HTML Transitional"规范,因此 - 但同样适用于其他浏览器的
。考虑到95%的所有内容都是粗鲁的,并且

所谓的HTML在万维网上找不到

例外,浏览器不能尽管有一些原始声称XML可以治愈这个烂摊子的网络,但同样的情况也在为XHTML开发。



MSIE treats all HTML as tag-soup. It has no real concept of the W3C
"HTML Transitional" specification, as such - but the same goes for
other browsers too. Considering that 95% of everything is crud, and
the so-called HTML that is found on the world-wild-web is no
exception, browsers can''t afford to be so choosy.

And the same situation is developing for XHTML too, despite some
original claims that XML would cure the web of this mess.


Jim Moe写道:
Jim Moe wrote:
不同的doc类型有点令人担忧 - 但我不知道我们对它们知之甚少,过分担心。我会尝试使用严格的
html。
The different doc types is a bit worrying though - but I don''t know
enough about them yet, to worry too much. I''ll try and stay with strict
html.


AIUI,IE并没有真正将XHTML视为XHTML。相反,它恢复为怪异模式并将代码视为HTML Transitional。

AIUI, IE does not really treat XHTML as XHTML. Rather it reverts to
quirks mode and treats the code as HTML Transitional.




这里有一些误解。


1:XHTML与HTML


在HTML模式下,浏览器使用标签汤诽谤来解析。

在XML模式下,使用XML解析器的浏览器在理论上更快。


鉴于XHTML文档作为XHTML,基于Mozilla的浏览器将进入

XML模式。这有很多效果,包括关闭增量

渲染和支持document.write。默认情况下,Internet Explorer将通过

默认提示用户下载文件而不是渲染文件。


鉴于XHTML文档是HTML格式,大多数浏览器会像HTML文档一样解析它,并且(感谢*大多数*浏览器中的错误)不渲染

">"每个XML样式的自闭标签之后的字符。


2:严格的Vs怪癖模式


鉴于文档作为HTML提供,很多浏览器都会看看Doctype和

使用它来判断作者的CSS知识(是的,HTML文档用于

只是CSS知识 - 愚蠢或什么?! )。


一个没有URL的HTML 4.01 Transitional Doctype将在IE中触发Quirks模式

6.这将导致它故意在CSS中犯一些错误

解析和渲染。


如果XHTML Doctype是文档中的第一个数据,那么XHTML Doctype将是IF和/或
(即在Doctype之前没有XML prolog [1]或评论)将触发

标准模式(并导致IE不故意制造错误(它会显示一些全新的)b $ b虽然错误))。


如果Doctype之前有任何内容,或者Doctype是HTML 4.01

过渡时没有URL,那么Quirks moed将被触发。


其他DTD触发各种不同的模式。 Google将帮助您找到

合适的文档。


[1]您不能在XHTML文档中使用其中一个作为text / html <无论如何,



-

David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



Some misconceptions here.

1: XHTML vs HTML

In HTML mode browsers use tag soup slurpers to parse.
In XML mode browsers using XML parsers which, in theory are faster.

Given an XHTML document served as XHTML Mozilla based browsers will go in to
XML mode. This has a number of effects, including turning off incremental
rendering and support for document.write. Internet Explorer will, by
default, prompt the user to download the file and not render it at all.

Given an XHTML document served as HTML, most browsers will parse it just
like an HTML document and (thanks to bugs in *most* browsers) not render
">" characters after every XML-style self closing tag.

2: Strict Vs Quirks mode

Given a document served as HTML, many browsers will look at the Doctype and
use it to judge the author''s CSS knowledge (yes, the HTML document used to
just the CSS knowledge - stupid or what?!).

An HTML 4.01 Transitional Doctype with NO URL will trigger Quirks mode in IE
6. This will cause it to intentionally make some mistakes with the CSS
parsing and rendering.

An XHTML Doctype will IF and ONLY if it is the first data in the document
(i.e. there is no XML prolog[1] or comment before the Doctype) will trigger
Standards mode (and cause IE to not intentionally make bugs (it will
exhibit some entirely new bugs though)).

If there is anything before the Doctype, or if the Doctype is HTML 4.01
Transitional with NO URL, then Quirks moed will be triggered.

Other DTDs trigger various different modes. Google will help you find
suitable documentation.

[1] You can''t have one of these in an XHTML document served as text/html
anyway

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


这篇关于以身作则?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆