Html文本控件(DIV无法识别在飞行中创建的另一个div ??)

时间:2011-10-06 10:11:39

标签: html css

<div id='imgCaption' style='background-color:grey;padding:5px 20px;color:white;'>
</div>
<script language="javascript>
 // lots of codes
$('#imgCaption').html(imgCaption + \"<div style='width:87px; float:right; text-align:right;'>\" + nextImgNum + ' of ' + totalNo + \"</div>\" );
</script>

结果不稳定。

第一个结果

Some caption text                                                         1 of 11

第二个结果

Some caption text continuing.....................................................
..                                                                        1 of 11

第三个结果

Some caption text continuing ...............................................
                                                                          1 of 11

第一个和第二个结果是正常的,因为标题文本和索引文本在同一行..

第3个结果不正常,因为它们在不同的行上。并且标题div的背景颜色不包括索引div。

结果,在第三个结果上看不到索引。

任何解决方法?

TKZ ..

1 个答案:

答案 0 :(得分:0)

这看起来像浮动问题,请尝试将overflow:hidden添加到<div id="imgCaption" />

相关问题