2012-01-28 82 views
1

这里是我的代码:你如何显示:表单元格的宽度:100% - 270px

<div id="banner" style="position:absolute; top:0px; width:100%; background:url('../../images/banner_repeat.jpg'); background-repeat:repeat-x; <!-- border:solid pink 1px; -->"> 
     <ul id="banner_ul"> 
      <li id="wrm"><a href="http://whiterootmedia.com"><i>The homepage of White Root Media!</i></a></li> 
      <li id="google"><a href="https://plus.google.com/u/0/b/115943543157099352927/115943543157099352927" target="_blank"><i>+1 us on Google!</i></a></li> 
      <li id="facebook"><a href="http://www.facebook.com/pages/White-Root-Media/194381903928501" target="_blank"><i>Like us on Facebook!</i></a></li> 
      <li id="twitter"><a href="http://twitter.com/#!/WhiteRootMedia" target="_blank"><i>Tweet about us on Twitter!</i></a></li> 
     </ul> 
    </div> 

    <div id="container" style="<!-- border:solid yellow 1px -->; display: table;"> 
     <div id="content" style="padding-top:90px; display:table-cell; min-width:945px; <!-- width:100% - 270px; -->"> 
      This content will determine the height 
     </div> 
     <div id="right_column" style="display: table-cell; <!-- border:solid orange 1px; --> height:100%; width:270px; background-image:url('../../images/treetrunk7.png');background-repeat:repeat-y;">tree</div> 
    </div> 

    <div id="footer" style="position:relative; top:-1px; background-image:url('../../images/grass.png'); background-repeat:repeat-x; width:100%; height:100px;">grass</div> 

这里的活页: http://whiterootmedia.com/test/test4/

我想内容的div是显示:表格单元格将页面的整个宽度减去270px。树应该一路向右。

任何帮助,非常感谢!

感谢, 达斯蒂

回答

0

您可以使用绝对定位的子div的

#foo { 
    display: table; 
    height: 400px; 
    position: relative; 
    width: 500px; 
} 

#foo > div { 
    display: table-cell; 
    height: 100%; 
    position: absolute; 
} 

#left { 
    background: blue; 
    left: 0; 
    right: 200px; 
} 

#right { 
    background: green; 
    right: 0; 
    width: 200px; 
} 

click here for demo

有达到同样的效果,如更改页边距的其他方法,我个人更喜欢上面的方法

相关问题