更改doctype会影响边框和背景 [英] Changing doctype affects border and background
问题描述
我正试图解决让我感到困惑的问题。
以下元素:
#wrapper {border:1px solid#000; background:#fff;}
使用此DTD时按预期渲染:
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.0 Transitional // EN">
但是当切换到这个DTD时:
<!DOCTYPE html PUBLIC" ; - // W3C // DTD XHTML 1.0 Strict // EN"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
无法渲染轮廓或背景颜色。
我缺少什么?
2005年6月8日星期三13:50:04 +0200,好儿子< go ****** @ freeuk.com>
写道:
< blockquote class =post_quotes>我正试图解决一个令我感到困惑的问题。
以下元素:
#wrapper {border:1px solid#000;背景:#fff;}
使用此DTD时按预期渲染:
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.0 Transitional // EN">
但是当切换到这个DTD时:
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN"
" http:/ /www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
无法呈现轮廓或背景颜色。
我错过了什么?
DOCTYPE切换。例如参见
http://gutfeldt.ch /matthias/articles/doctypeswitch.html
浏览器对语法错误的宽容度较低,而且一些CSS属性更严格地解释为
使用''现代''Doctype触发Stabdards模式渲染
。
-
现在获取Opera 8!速度,安全性和简单性。
http://my.opera.com / Rijk / affiliate /
Rijk van Geijtenbeek
Rijk van Geijtenbeek写道:2005年6月8日星期三13:50:04 +0200,好儿子< go ****** @ freeuk.com>
写道:
我正试图解决一个令我感到困惑的问题。
以下元素:
#wrapper {border:1px solid# 000;背景:#fff;}
使用此DTD时按预期渲染:
<!DOCTYPE HTML PUBLIC" - // W3C // DTD HTML 4.0 Transitional // EN">
但是当切换到此DTD时:
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Strict // EN" ;
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
无法渲染轮廓或背景颜色。 />
我缺少什么?
DOCTYPE切换。例如参见
http://gutfeldt.ch /matthias/articles/doctypeswitch.html
浏览器对语法错误的宽容度较低,当触发Stabdards模式时,某些CSS属性会被更严格地解释
通过使用''现代''Doctype进行渲染。
为什么使用XHTML?就个人而言,我会从
过渡到严格,但不是HTML 4.0过渡到
XHTML 1.0 Strict。请阅读:
http://www.hixie.ch/advocacy/xhtml 有关这将产生的
问题的更多信息。纠正我,如果我错了,但是
转到XHTML并发送文本/ html触发怪癖模式
在大多数浏览器上。
JL
Justin Lieb写道:如果我错了,请纠正我,但要转到XHTML并发送为
text / html在大多数浏览器上触发怪癖模式。
考虑自己纠正。只有当<?xml
行出现在DOCTYPE之前时,IE6才会出现这种情况。
I''m trying to get my head around a problem that has me baffled.
The following element:
#wrapper {border:1px solid #000;background:#fff;}
Renders as expected when using this DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
But when switching to this DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Neither the outline or background colour is rendered.
What am I missing?
On Wed, 08 Jun 2005 13:50:04 +0200, The Good Son <go******@freeuk.com>
wrote:
I''m trying to get my head around a problem that has me baffled.
The following element:
#wrapper {border:1px solid #000;background:#fff;}
Renders as expected when using this DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
But when switching to this DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Neither the outline or background colour is rendered.
What am I missing?
DOCTYPE switching. See for example
http://gutfeldt.ch/matthias/articles/doctypeswitch.html
Browsers are less forgiving of syntax errors, and some CSS properties are
interpreted more strictly, when you trigger Stabdards mode rendering by
using a ''modern'' Doctype.
--
Get Opera 8 now! Speed, Security and Simplicity.
http://my.opera.com/Rijk/affiliate/
Rijk van Geijtenbeek
Rijk van Geijtenbeek wrote:On Wed, 08 Jun 2005 13:50:04 +0200, The Good Son <go******@freeuk.com>
wrote:I''m trying to get my head around a problem that has me baffled.
The following element:
#wrapper {border:1px solid #000;background:#fff;}
Renders as expected when using this DTD:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
But when switching to this DTD:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Neither the outline or background colour is rendered.
What am I missing?
DOCTYPE switching. See for example
http://gutfeldt.ch/matthias/articles/doctypeswitch.html
Browsers are less forgiving of syntax errors, and some CSS properties
are interpreted more strictly, when you trigger Stabdards mode
rendering by using a ''modern'' Doctype.
Why are you using XHTML? Personally I would go from
transitional to strict, but not HTML 4.0 Transitional to
XHTML 1.0 Strict. Please read:
http://www.hixie.ch/advocacy/xhtml for more info on the
problems this will create. Correct me if I''m wrong, but
going to XHTML and sending as text/html triggers quirks mode
on most browsers.
JL
Justin Lieb wrote:Correct me if I''m wrong, but going to XHTML and sending as
text/html triggers quirks mode on most browsers.
Consider yourself corrected. This only happens with IE6 when the <?xml
line appears prior to the DOCTYPE.
这篇关于更改doctype会影响边框和背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!