html - 为什么适合 div 内部的图像在 WIndows XP 上为 IE 8 扩展 div

标签 html css internet-explorer-8 css-float windows-xp

这是源代码:

<div id="myID1" class="AutoDiv-small"
  style="left:547.5px; top:41px;  width:380px; height:445px;">
    <div id="TitleBar" class="PopupTitleBar"
      style="width: 100%; height: 20px; line-height: 15px;
      font-weight: bold; text-align: center; verticle-align: middle;
      background-image: URL('images/title bar.png');
      background-repeat: repeat-x;">My Title<a onclick="HideContent(myID1);" href=#>
        <img style="float: right; padding: 1px;" border=0
          src="images/close_red.png">
        </a>
    </div>
    //Lot's of other content
</div>

它在 XP 上除了 IE8 之外的所有东西看起来都很好;在 XP 上一切都比 IE8 新。我也必须让它在此浏览器上正确显示。

“好”是指与文字在同一行显示在右侧背景内。

IE8 将图像向下推到一行,这将它放在背景图像之外,并将包含 div 内的其余内容也向下推。

最佳答案

也许你应该使用表格,我不明白表格的问题。我给你做了一把 fiddle http://jsfiddle.net/TKvGj/ .这是适合您的基本表结构:

<table style="width:300px">
<tr>
  <td>Your text here</td>
  <td><a onclick="HideContent(myID1);" href=#><img style="float: right; padding: 1px;" border=0 src="http://avatarmaker.net/free-avatars/avatars/animated_214/sleepy_cat_animated_avatar_100x100_29622.gif" /></a></td>     
  </tr>
</table>

这对我来说很好用。希望我回答了你的问题。

关于html - 为什么适合 div 内部的图像在 WIndows XP 上为 IE 8 扩展 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21787379/

相关文章:

css - 关于click事件的csstransition效果

CSS 4 个边 Angular 都翘起?

css - 图像作为 ie7+8 中视网膜显示的背景

javascript - 使用 html.innerHTML 设置 html 内容,以便它在 IE 8 和 9 中工作

jquery - 当我使用 jQuery 在页面上选择任何文本时,我将如何显示对话框?

css - 如何使 Firefox 按钮看起来像 Chrome 按钮(边框,边框半径,填充,边距..)

html - 用 3 个 div 填充屏幕

internet-explorer - Facebook 登录/点赞在 IE8 上失败

html - 输入 [type ="file"] 使用 css 检查文件附件是否存在

javascript - 在javascript中计算上一个结束日期和下一个开始日期之间的差距