Two divs; left should be fixed width, right should fill rest of space

前端 未结 1 1143
借酒劲吻你
借酒劲吻你 2020-12-15 18:49

I\'ve got the following HTML code:

 
Side panel, fixed widt
相关标签:
1条回答
  • 2020-12-15 19:41

    Here's that link, applied to your code:

    CSS

    #frame   { background:pink }
    #panel   { background:orange; width:200px; float:left }
    #content { background:khaki; margin-left:200px }
    #foot    { background:cornflowerblue }
    

    HTML

    <div id='frame'>
      <div id='body'>
    
        <div id='panel'>
          Side panel, fixed width.
        </div>
    
        <div id='content'>
          The rest of the content, should be dynamic width and fill up rest of space 
          horizontally.
        </div>
    
      </div><!-- End #body -->
    
      <div id='foot'>
        <div>FooBar.</div>
      </div>
    
    </div><!-- End #frame -->
    

    Works pretty well! Although, IMHO, you don't need the frame or body (but I don't know the master plan). That would look like this:

    <div id='panel'>
      Side panel, fixed width.
    </div>
    
    <div id='content'>
      The rest of the content, should be dynamic width and fill up rest of space 
      horizontally.
    </div>
    
    <div id='foot'>
      <div>FooBar.</div>
    </div>
    
    0 讨论(0)
提交回复
热议问题