div 的文本覆盖在另一个文本之上,IE8 则不会覆盖文本

发布于 2025-01-01 14:25:06 字数 2472 浏览 3 评论 0原文

我有两个div,左对齐右对齐。我需要左边的方块越过右边的方块。如您所知,IE 仍然是问题...两个块中的文本是混合的,没有经过处理,文本似乎是独立的。

jsfiddle http://jsfiddle.net/P3Qgb/

这里的代码:

<html>
    <style>
            #root {
                position:fixed;
            }

        #content {
          height: 200px;
          width: 400px;
          border: 1px solid red;    
          position:fixed;
        }    

        #bloc-left {
                position:absolute;
                float: left;
                height: 190px;
                border: 1px solid black;
                width: 60%;
                overflow:auto;

                background-image: linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -o-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -moz-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -ms-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fbfbfb), color-stop(1, #e2e2e2));
        }

        #bloc-right {
                float: right;
                width: 45%;
                height 190px;
                border: 1px solid black;
        }    
    </style>

    <body>
            <div id=""root">
            <div id="content">
             <div id="bloc-left">
              Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
             </div>
          <div id="bloc-right">
              Lorem Ipsum is simply dummy text of the printing and typesetting 
          </div>
      </div>
        </div>

    </body>
</html>

目标是添加一个链接使用一些 js 将左侧块扩展到右侧块。

感谢您的帮助 !

编辑:添加根div

I have two div, the left align with the right one. I need the left block to go over the right. As you know IE is still the problem ... The text in the two blocks is mixed, no over is processed, the text seems indepdendent.

The jsfiddle http://jsfiddle.net/P3Qgb/

Here the code :

<html>
    <style>
            #root {
                position:fixed;
            }

        #content {
          height: 200px;
          width: 400px;
          border: 1px solid red;    
          position:fixed;
        }    

        #bloc-left {
                position:absolute;
                float: left;
                height: 190px;
                border: 1px solid black;
                width: 60%;
                overflow:auto;

                background-image: linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -o-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -moz-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -webkit-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -ms-linear-gradient(top, #fbfbfb 0%, #e2e2e2 100%);
                background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0, #fbfbfb), color-stop(1, #e2e2e2));
        }

        #bloc-right {
                float: right;
                width: 45%;
                height 190px;
                border: 1px solid black;
        }    
    </style>

    <body>
            <div id=""root">
            <div id="content">
             <div id="bloc-left">
              Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
             </div>
          <div id="bloc-right">
              Lorem Ipsum is simply dummy text of the printing and typesetting 
          </div>
      </div>
        </div>

    </body>
</html>

The goal is to add a link which expand the left block over the right, with some js.

Thanks for your help !

EDIT: add root div

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无声情话 2025-01-08 14:25:06

添加:

z-index: 1;#bloc-left

更改:

position:fixed;position:relative;代码> #content

add:

z-index: 1; to #bloc-left

change:

position: fixed; to position: relative; on #content

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文