中间div占用剩余空间? [英] middle div take up remaining space?

查看:641
本文介绍了中间div占用剩余空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个 div s,

divl : 7px width
divr: 7px width
divm: unknown

我想要做的是:


  • 在父母的左边有 divl c> div c> c> c> / code>

  • divm

  • Have divl at the very left of the parent div,
  • divr at the very right of the parent div.
  • divm in between those two divs and span the remaining space.

如何做到这一点?

推荐答案

可能要使用已链接的


Blockquote http://matthewjamestaylor.com/blog/perfect-3-column.htm

或参阅 http://www.webreference.com/authoring/style/sheets/css_mastery2/index.html (以及后续页面)
我想出了以下情况,但你可能会最终在左侧和中间div的内容上有重叠(您可以尝试将z-index添加到中间div,这可能会有帮助。)

Or see http://www.webreference.com/authoring/style/sheets/css_mastery2/index.html (and the subsequent pages) I came up with the following but you'll probably end up with an overlap on content from the left and middle divs (you could try adding z-index to the middle div as well, that may help.)

   <html> 
    <style type="text/css">
      #divl { width: 7px; float: left; height: 100px; }
      #divm { width: 100%; height: 100px; margin: 0 -7px; float: left; }
      #divr { width: 7px; height: 100px; float: left; }
    </style>
      <body>
        <div id="divl"></div>
        <div id="divm"></div>
        <div id="divr"></div>
      </body>
    </html>

这篇关于中间div占用剩余空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆