老歌剧使浮动的DIV太宽 [英] Old Opera makes floated DIV too wide

查看:57
本文介绍了老歌剧使浮动的DIV太宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这就是我所拥有的:


< div>

< img .. 。>< br>

标题文字

< / div>


div左移,没有宽度设置,内容居中,

没有边距或填充< img> (只是一个底部边缘和

1px边框),文字大致与图像一样宽。在IE5 +,Mozilla和OP7中,它看起来很好,但是OP5显示div大约两倍宽,而OP6 a比它应该宽一点。我认为浮动会自动缩小,因为内容允许的时候会有很多东西缩小 - 所以旧的歌剧怎么会让它更宽?


任何魔法来治愈这个?

Hi,
Here''s what I have:

<div>
<img ...><br>
Caption text
</div>

The div is floated left and has no width set, the content is centered, there
are no margins or padding on the <img> (just a bottom margin and
1px-borders) and the text is about as wide as the image. It looks fine in
IE5+, Mozilla and OP7, but OP5 shows the div about twice as wide and OP6 a
bit wider than it should. I thought a float would automatically shrink as
far as the content permits - so how come the old Operas make it wider?

Any magic spell to cure this?

推荐答案

On Sun,2004年12月12日00:28:45 +0100,Thomas Mlynarczyk

< bl * ************@hotmail.com>写道:
On Sun, 12 Dec 2004 00:28:45 +0100, Thomas Mlynarczyk
<bl*************@hotmail.com> wrote:

这就是我所拥有的:

< div>
< img ... >< br>
标题文字
< / div>

div左移,没有宽度设置,内容居中,
那里
在< img>上没有边距或填充(只是一个底边距和
1px边框),文字大致与图像一样宽。在IE5 +,Mozilla和OP7中它看起来很好,但是OP5显示div大约两倍宽,OP6比它应该宽一点。我认为浮动会自动收缩,因为内容允许 - 所以老戏剧怎么会让它更宽?

任何魔法咒语来解决这个问题?
Hi,
Here''s what I have:

<div>
<img ...><br>
Caption text
</div>

The div is floated left and has no width set, the content is centered,
there
are no margins or padding on the <img> (just a bottom margin and
1px-borders) and the text is about as wide as the image. It looks fine in
IE5+, Mozilla and OP7, but OP5 shows the div about twice as wide and OP6
a
bit wider than it should. I thought a float would automatically shrink as
far as the content permits - so how come the old Operas make it wider?

Any magic spell to cure this?



指定浮动或定位DIV的宽度,不要依赖

收缩包装。 Opera 4和5遵循CSS 2.0规范的字母,

忽略了引入收缩包装行为的勘误表...... Opera 6

CSS 2.1中描述的机制。虽然嵌套浮动有一段时间会出现问题,但是b $ b会收缩一些过于激进(尝试在浮动的UL中浮动LI,

Opera 7曾经放置过新线上的每个LI)。


-

Rijk van Geijtenbeek


网络是一种拖延仪器:

它可以吸收所需的时间,以确保你不会得到任何真正的工作。 - J.Nielsen



Specify widths for floated or positioned DIVs, don''t rely on
shrinkwrapping. Opera 4 and 5 follow the CSS 2.0 spec to the letter,
ignoring the errata that introduced the shrink-wrap behavior... Opera 6
fixes some of the problems, Opera 7 follows the mechanism as described in
CSS 2.1. Though it had some problems for a while with nested floats, which
would shrinkwrap a bit too aggressive (try to float LIs in a floated UL,
Opera 7 used to put each LI on a new line).

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won''t get any real work done. - J.Nielsen


还有Rijk van Geijtenbeek:
Also sprach Rijk van Geijtenbeek:
指定浮动或定位DIV的宽度,不要不依赖
收缩包装。
Specify widths for floated or positioned DIVs, don''t rely on
shrinkwrapping.




但我事先并不知道宽度。即使我为每个单独计算它们< img>我说,还有标题文本可以用任何大小或任何字体显示在

中。指定宽度如1px仅适用于IE

(扩展宽度以适应内容),但不适用于Opera。有些

额外的HTML标记帮助 - 比如将所有内容包装在一个额外的

容器中< div>并以某种方式修改样式?也不是很优雅,

但可能是最好的解决方案......或者我应该忽略OP< 7?



But I don''t know the widths in advance. Even if I calculate them for every
single <img> I put, there''s still the caption text which may be displayed in
any size or any font. Specifying a width like 1px would work only in IE
(expanding the width to fit the content), but not in Opera. Would some
additional HTML markup help - like wrapping everything in an additional
container <div> and modifying the styles somehow? Not very elegant either,
but probably the best solution... Or should I simply ignore OP<7?


On Sun,12月12日2004 13:30:43 +0100,Thomas Mlynarczyk

< bl ************* @ hotmail.com>写道:
On Sun, 12 Dec 2004 13:30:43 +0100, Thomas Mlynarczyk
<bl*************@hotmail.com> wrote:
还有Rijk van Geijtenbeek:
Also sprach Rijk van Geijtenbeek:
指定浮动或定位DIV的宽度,不要依赖
收缩包装。
Specify widths for floated or positioned DIVs, don''t rely on
shrinkwrapping.



但我事先并不知道宽度。即使我计算它们每个
单个< img>我说,仍然有标题文字可以用任何大小或任何字体显示
。指定像1px这样的宽度只能在IE中工作(扩展宽度以适应内容),但不能在Opera中使用。是否有一些
额外的HTML标记有帮助 - 比如将所有内容包装在一个额外的
容器中< div>并以某种方式修改样式?也不是很优雅
,但可能是最好的解决方案......或者我应该忽略OP< 7?



But I don''t know the widths in advance. Even if I calculate them for
every
single <img> I put, there''s still the caption text which may be
displayed in
any size or any font. Specifying a width like 1px would work only in IE
(expanding the width to fit the content), but not in Opera. Would some
additional HTML markup help - like wrapping everything in an additional
container <div> and modifying the styles somehow? Not very elegant
either,
but probably the best solution... Or should I simply ignore OP<7?




最好的解决方案取决于在你正在制作的页面类型上。但是,我真的希望Opera 6在桌面上不再使用得太多了,所以如果

最终结果是可读的,那可能就足够了。同样的Opera 6

渲染引擎也用于移动版本,你可以安装在诺基亚系列60手机和其他一些手机上(如SonyEricson P800和

P900),所以最好花一些时间在media =掌上电脑/ b $ b样式表上,而不是在桌面上优化Opera 6。见

< URL:http://alistapart.com/articles/pocket/>一些提示。


-

Rijk van Geijtenbeek


网络是一种拖延机器:

它可以吸收所需的时间,以确保你不会得到任何真正的工作。 - J.Nielsen



The best solution depends on the type of page you are making. But I
sincerely hope Opera 6 isn''t used much anymore on the desktop, so if the
end result is readable that might just be good enough. The same Opera 6
rendering engine is also used in the mobile versions you can install on
Nokia Series 60 phones and some others (like the SonyEricson P800 and
P900), so it might be better to invest some time in a media=handheld
stylesheet instead of optimizing for Opera 6 on the desktop. See
<URL:http://alistapart.com/articles/pocket/> for some tips.

--
Rijk van Geijtenbeek

The Web is a procrastination apparatus:
It can absorb as much time as is required to ensure that you
won''t get any real work done. - J.Nielsen


这篇关于老歌剧使浮动的DIV太宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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