css - HTML: flowed <pre> with absolute positioning -


i have centered column of text, has fixed width. however, want break fixed width <pre> (and other tags), fill full screen width, while keeping flow text.

so far, have following css:

pre {   float: left;   left: 0;   padding: 1em;   position: absolute; } 

so, in html fragment, paragraphs in centered column on page, correct.

<div class="bodice">   <p>some text.  more text.</p>   <pre>here's code!</pre>   <p>yet more text.  , more text.</p> </div> 

however, text within <pre> not flowed overlaps, isn't quite effect want. does have correct position: aligned against left side of screen.

a more complete example, @ jsfiddle: http://jsfiddle.net/jashank/vbkdp/

how have <pre> flowing rest of paragraphs while aligning left?

so, after discussion think understood looking for.

html

    <div class="header">         <h1>[jashank] / diary</h1>          <p><small>             <!-- &#187;&nbsp;<a href="#xkcd">xkcd</a>&nbsp;&nbsp; -->              </small></p>     </div>      <div class="bodice">         <div id="post">             <p>i've pulled lyx's svn sources, , compiled them cmake build                 system; , good.  however, when attempt start lyx:</p>              <pre> <strong>jashank@jashank</strong> <span style="color: #0000ee;">(pts/33)</span> <span style="color: #cd0000;">~/software/lyx-build</span> <span style="color: #0000ee;">[0 jobs]</span> <u>!3027</u> 2011-07-03 10:49:15 &gt;&gt;&gt;&gt;&gt; bin/lyx2.1 zsh: segmentation fault (core dumped)  bin/lyx2.1             </pre>              <div style="clear: both;"></div>              <p>                 tracing coredump doesn't either; looks me stack                 smashed.             </p>              <p>                 time later, after aspell glitch , few patches fix                 neurotic breakage:             </p>              <pre> 11:11:07 &lt;nox&gt; wow built! :) 11:11:28 &lt;jashank&gt; nox: try running bin/lyx2.1 11:12:02 &lt;nox&gt; segfaults in ucs4le_mbtowc             </pre>              <p>                 in other words, doesn't appear bitness issue, occurs                 in 32- , 64-bit modes.  doesn't bode well.             </p>          </div>      </div> 

css

body {     font-family: sans-serif;     margin: 0;     text-align: center; }  div.header {     text-align: center; }  div.bodice {     margin: 0;     text-align: center;     width: 100%; }  .bodice p {     margin: 0 auto;     text-align: justify;     width: 50ex;     overflow: auto; }  div#post pre {     text-align: left;     width: 100%;     padding: 1em; }  body {     text-align: center; }  h1, h2, h3, h4, h5, h6 {     text-align: center; } 

example

there's jsfiddle can view solution in action.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -