首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IE问题: Div定位

IE问题: Div定位
EN

Stack Overflow用户
提问于 2010-12-15 12:55:11
回答 5查看 261关注 0票数 0

我希望我的页面看起来像这样:

代码语言:javascript
复制
+------+------+
|first |third |
|      |      |
+------+------+
|second|     
|      |      
+------+   

在FF和Chrome的最新版本中,下面的片段按其应有的方式工作。但是在IE中,输出如下所示:

代码语言:javascript
复制
+------+
|first | 
|      |    
+------+------+
|second| third|    
|      |      |
+------+------+   

我的剪刀

代码语言:javascript
复制
 <style>
    #wrapper
    {
        width: 680px;
    }

    #first
    {
        background: Red;
        float: left;
        width: 500px;
    }

    #second
    {
        background: Green;
        float: left;
        width: 500px;
    }

    #third
    {
        background: Red;
    }
</style>
<div id="wrapper">
    <!-- 1st two Divs-->
    <div id="first">Div ONE</div>
    <div id="second">Div TWO</div>
    <!-- 3rd Div should be on the top right side next to div one -->
    <div id="third">Div Three</div>
</div>

如果您能在不改变html标记的情况下给我一个解决方案,我将非常感激。

谢谢您抽时间见我!

瑞士安德鲁

EN

回答 5

Stack Overflow用户

回答已采纳

发布于 2010-12-15 13:30:22

在这里,这应该是可行的:

代码语言:javascript
复制
#wrap { width:800px; position:relative; }
#first, #second, #third { width:400px; height:400px; }
#third { position:absolute; top:0; right:0; }

工作演示: http://vidasp.net/tinydemos/layout.html

票数 0
EN

Stack Overflow用户

发布于 2010-12-15 13:05:57

试试这个:

代码语言:javascript
复制
<style>
    #wrapper
    {
        width: 680px;
    }

    #first
    {
        background: Red;
        float: left;
        width: 500px;
    }

    #second
    {
        background: Green;
         width: 500px;

    }

    #third
    {
        background: Red;
        float: left;

    }
</style>

您必须将第三个div从左浮动,并从第二个div中移除浮点数。

您不必编辑html,但必须重新排序div:

代码语言:javascript
复制
<div id="wrapper">
    <div id="first">Div ONE</div>
    <div id="third">Div Three</div>
    <div id="second">Div TWO</div>
</div>

这将给你展示的顺序,你正在寻找。

票数 1
EN

Stack Overflow用户

发布于 2010-12-15 13:01:06

解决问题的方法很多。将包装宽度设置为1000 to。另外,您已经在第三次尝试了float: left;?..and,可能像这样的教程会帮助您:http://www.devarticles.com/c/a/Web-Style-Sheets/DIV-Based-Layout-with-CSS/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4450079

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档