title: Side by side Divs with dynamic content
body: <p>I am generating an outline dynamically by creating panel and labels in ASP.NET.  Each node in the outline has an outline number, and outline text, which come from a database defining nodes in a children/parent kind of structure to define the outline tree.  For each entry in the outline, I'd like the left div to contain the outline number, and the right div to contain the outline text.</p>
  
  <p>The left div should be some specific min width, like 50px, and should get wider if necesary to fit larger outline numbers, because occasionally the outline number might be "Section VI.".  Or alternatively all outline number divs should be the width of the largest width required to support the largest outline number.</p>
  
  <p>The right div should wrap the text if the constraints of the container or window prevent the text from appearing all on one line.</p>
  
  <pre><code>*--------------Window or container----------------*
  |Part I.    A small amount of outline text.       |
  |   Section. I  A larger amount of text is here   |
  |               showing text wrapping in its own  |
  |               block.                            |
  |Part II.   More text here with a little wrapping |
  |           going on.                             |
  |Part III.  A little bit more text.               |
  </code></pre>
  
  <p>I have tried lots of combination.  I am new to using divs, and I can't find a good methodology for constructing layouts.  It seems everything I find is very specific to a certain layout and isn't really adaptable to something else, or it uses very specific sizes for the divs.</p>
  
  <p>I am generating this dynamically, so it's not until runtime that I know how much text will go there.  So using fixed sizes and absolute positioning is not really viable unless I were to do alot of calculations and measuring of strings, which I'm afraid of how reliable that will be.  I fear I'd get done writing it and find quirks in how consistent the measurements done by .NET are versus how the browsers actually render the text.</p>
  
  <p>This is not a big deal or requirement, but additionally, fixed sizes would make it so resizing the outer container or window would not allow the text to fill the new space, or when the container/window is made smaller the text will not wrap appropriately and will instead create a scroll bar.</p>
  
  <p>Right now I have a panel for the outline number containing a label, and I assign the panel a Css class, and the outline text is in a seperate panel with it's own css class, and lastly the two are stuffed into a panel that has a left margin set dynamically based on the indentation.  Just about anything you can show my in html markup with divs I can emulate, given that you consider that the content is database driven and thus doesn't have a predetermined width.</p>
  
  <p>If you think I should just do this by creating a two column table for each entry then I'd be glad to here your opinion.</p>
  
  <p>Edit:  This is one approach I tried a couple different ways:</p>
  
  <p><a href="http://www.alistapart.com/articles/holygrail/" rel="nofollow noreferrer">http://www.alistapart.com/articles/holygrail/</a></p>
  
  <p>If the outline number was too long it would wrap, or it would overlap the other div, depending on how I tweaked it.  Instead I'd want the left column to expand to fit the content.  I couldn't find a way to tweak it to accomodate that.  It's not required that all the outline numbers match up in these special cases.  If the oddball has a slightly different indentation because the outline number was too long, that's ok.  Just as long as the outline number doesn't wrap or overlap other text.</p>
  
  <p>Edit 2: The other thing I reallized with going the route of measuring strings, is my fonts are defined by a *.css file.  So during page load I'm not sure how to determine what font will be used, because that is neceary for measuring the rendered width of the string.</p>
  
  <p>Edit 3: This is the last thing I tried but if the outline number is too long it wraps and than overlaps the content to the right.</p>
  
  <pre><code>&lt;div id="container"&gt;  
    &lt;div id="center" class="column"&gt;Application Information blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah &lt;/div&gt;
    &lt;div id="left" class="column"&gt;Part VVVVVVVVVVVV.&lt;/div&gt;
  &lt;/div&gt;
  
  #container {
    padding-left: 50px;   /* LC width */  
  }
  
  #center {
    width: 100%;  
    position: relative;
    float: left;
  }
  
  #left 
  {
    position: relative;
    float: left;
  
    width: 50px;          /* LC width */
    right: 50px;          /* LC width */
    margin-left: -100%;
  }
  </code></pre>