html - CSS 在 Internet Explorer 中不能正常工作? (绝对定位)

标签 html css internet-explorer compatibility

页面上的许多其他内容也使用绝对定位,但出于某种原因,“投票”和“个人资料”按钮在 Internet Explorer 9/10 中向右显示数百像素,向上显示大约五十像素(8- 在这里不是问题)。 HTML 中没有样式,就在这里。有什么突出的吗?谢谢!

        .contain{
        margin-left:-65px;
        margin-top:-85px;
        position:absolute;

    }
    .video_display1{
        background-color:#333;
        width:250px;
        height:200px;
        margin-top:40px;
        margin-left:88px;
    display:inline;
    }
    .profile1{
        width:49px;
        height:12px;
        margin-left:87px;
        margin-top:3px;
        position:absolute;
    }
    .vote1{
        margin-top:3px;
        margin-left:240px;
        position:absolute;
    }
    .display_vote1{
        margin-left:295px;
        margin-top:2px;
        font-size:11px;
        position:absolute;
    }

这是 HTML:

            <span class="contain">
                <iframe class="video_display1" width="250" height="200" src=""> </span>
                <span class="profile1"><img src=''/></span>     
                <span class="vote1"><input type="image" src=''/></span>             
                <span class="display_vote1"></span>
            </span>

和文档类型:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

最佳答案

您还没有定义图像的宽度和高度,因此要获得固定的高度和宽度,请先定义它。并在 .contain 中使用 display: inline-block; 然后只有你得到你想要的。

关于html - CSS 在 Internet Explorer 中不能正常工作? (绝对定位),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15468639/

相关文章:

html - Youtube 嵌入 iframe,使用 Chrome 我得到一个黑框

html - 在汉堡图标旁边添加 "MENU"字 - 对我来说是奇怪的代码

javascript - ie9 ajax跨域withCredentials不发送cookie

javascript - IE6 中的 JSON 对象 - 如何?

javascript - IE不支持方法 'assign',怎么办

javascript - 如何使图像从左侧 0,0 位置向右滑动到右侧末端?

jQuery 在点击和切换类时仅切换一个具有相同类的 div

javascript - 如何使用 ng-repeat 创建缩略图格式的 m 元素列表,其中一行有 n 个元素

jquery - 在表格中水平显示单选按钮选项?

html - 标签内的复选框?