如何在IE和Mozzila中使用CSS居中图像 [英] How to center an image using CSS in both IE and Mozzila
问题描述
我们正在使用:
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns =" http: //www.w3.org/1999/xhtml" XML:朗= QUOT;恩" lang =" en">
使用CSS(不支持html,因为align = center和< center>已被弃用)
我可以让它在IE6(但不是NS 7或Firefox)中使用。
< div style =" text-align:center;显示:块; ">< img src =" myimg.gif"
alt ="我的徽标"宽度= QUOT; 201" height =" 56" />< / div>
我可以在NS 7或Firefox(但不是IE6)中使用它。
< div style =" text-align:-moz-center;显示:块; ">< img src =" myimg.gif"
alt ="我的徽标"宽度= QUOT; 201" height =" 56" />< / div>
我见过很多在IE上工作的解决方案,只有有人知道怎么做
$两个都是b $ b?
谢谢
Mike
We are using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Using CSS (not html since align=center and <center> are deprecated)
I can get it to work in IE6 (but not NS 7 or Firefox) with.
<div style="text-align:center; display:block; "><img src="myimg.gif"
alt="My logo" width="201" height="56"/></div>
I can get it to work in NS 7 or Firefox (but not IE6) with.
<div style="text-align:-moz-center; display:block; "><img src="myimg.gif"
alt="My logo" width="201" height="56"/></div>
I''ve seen many solutions that work in IE only does anyone know how to do it
in both?
Thanks
Mike
推荐答案
2004年11月10日星期三14:43:03 -0500,Mike< no ** @ nospam.com>写道:
On Wed, 10 Nov 2004 14:43:03 -0500, Mike <no**@nospam.com> wrote:
我们正在使用:
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns =" http://www.w3 .ORG / 1999 / XHTML" XML:朗= QUOT;恩"郎= QUOT;恩">
哦,好吃。
使用CSS(不是html,因为align = center和< center>已被弃用)
We are using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Oh goody.
Using CSS (not html since align=center and <center> are deprecated)
的确如此。但是,为什么你在使用松散的DTD时,为什么要避免弃用标记?
< div style =" text-align :center;">< img src =" myimg.gif" alt ="我的徽标"
width =" 201"高度= QUOT; 56" />< / div>
注意:
1)因为img是一个块元素,所以没有必要在显示:块;
2)当使用XHTML提供给HTML浏览器时,你需要在斜杠之前有一个空格< img />
。 />
Indeed. Though, why are you bothering to use a loose DTD if you''re
avoiding deprecated markup?
<div style="text-align: center;"><img src="myimg.gif" alt="My logo"
width="201" height="56" /></div>
Note:
1) As img is in a block element, there''s no point in display: block;
2) When using XHTML served to HTML browsers you need a space <img />
before the slash.
从前* Mike *写道:
Once upon a time *Mike* wrote:
我们正在使用:
<!DOCTYPE html PUBLIC" - // W3C // DTD XHTML 1.0 Transitional // EN"
" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< html xmlns =" http://www.w3.org/1999/xhtml" XML:朗= QUOT;恩" lang =" en">
使用CSS(不是html,因为align = center和< center>已被弃用)
我可以在IE6中使用它(但不是NS 7或Firefox)。
< div style =" text-align:center;显示:块; ">< img src =" myimg.gif"
alt ="我的徽标"宽度= QUOT; 201" height =" 56" />< / div>
We are using:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Using CSS (not html since align=center and <center> are deprecated)
I can get it to work in IE6 (but not NS 7 or Firefox) with.
<div style="text-align:center; display:block; "><img src="myimg.gif"
alt="My logo" width="201" height="56"/></div>
这在Mozilla 1.7.3中效果非常好所以我想知道为什么Firefox和NS 7 >
是如此不同?你真的需要display:block吗?那里?不是那个
我知道它是否有任何不同(它在Moz 1.7中没有)但仍然......
-
/ Arne
http://w1.978 .telia.com / ~u97802964 /
2004年11月10日星期三14:43:03 -0500,Mike写道:
On Wed, 10 Nov 2004 14:43:03 -0500, Mike wrote:
我可以在IE6(但不是NS 7或Firefox)中使用它。
< div style =" text-align:center;显示:块; ">< img src =" myimg.gif"
alt ="我的徽标"宽度= QUOT; 201" height =" 56" />< / div>
我可以在NS 7或Firefox(但不是IE6)中使用它。
< div style =" ;文本对齐:-moz-中心;显示:块; ">< img src =" myimg.gif"
alt ="我的徽标"宽度= QUOT; 201" height =" 56" />< / div>
我见过许多可以在IE中运行的解决方案,只有有人知道如何在两者中这样做吗?
I can get it to work in IE6 (but not NS 7 or Firefox) with.
<div style="text-align:center; display:block; "><img src="myimg.gif"
alt="My logo" width="201" height="56"/></div>
I can get it to work in NS 7 or Firefox (but not IE6) with.
<div style="text-align:-moz-center; display:block; "><img src="myimg.gif"
alt="My logo" width="201" height="56"/></div>
I''ve seen many solutions that work in IE only does anyone know how to do it
in both?
这* *可能*是CSS导入黑客的工作或
IE条件评论。 (如果你们两个都正确地理解了
问题并且我理解正确的话。)
哈克......(听着被大声喊叫的声音......; )
-
Andrew Thompson
http://www.PhySci.org/codes/ Web& IT帮助
http://www.PhySci.org/ 开源软件套件
http://www.1point1C.org/ Science&技术
http://www.LensEscapes.com/ 图像逃脱世俗的
This *might* be a job for either CSS import hacks or
IE conditional comments. (If both you understand the
problem correctly and I understand you correctly.)
Hark.. ( listens for the sound of being shouted down.. ;)
--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
这篇关于如何在IE和Mozzila中使用CSS居中图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!