Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6113501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:51:59+00:00 2026-05-23T14:51:59+00:00

I have a centered column of text, which has a fixed width. However, I

  • 0

I have a centered column of text, which has a fixed width. However, I want to break that fixed width for <pre> (and some other tags), where they fill the full screen width, while keeping flow with the text.

So far, I have the following CSS:

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

So, in this HTML fragment, the paragraphs are in a centered column on the page, which is correct.

<div class="bodice">
  <p>Some text.  Some more text.</p>
  <pre>Here's some code!</pre>
  <p>Yet more text.  And some more text.</p>
</div>

However, the text within the <pre> is not flowed overlaps, which isn’t quite the effect I want. It does have the correct position: aligned against the left side of the screen.

A more complete example, at jsFiddle: http://jsfiddle.net/Jashank/VbKDP/

How do I have the <pre> flowing with rest of the paragraphs while aligning it to the left?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:51:59+00:00Added an answer on May 23, 2026 at 2:51 pm

    So, after some discussion I finally think I understood what you were 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, and compiled them with the CMake build
                    system; all well and good.  However, when I attempt to 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 the coredump doesn't help either; looks to me like the stack
                    was smashed.
                </p>
    
                <p>
                    Some time later, after an aspell glitch and a few patches to fix
                    neurotic breakage:
                </p>
    
                <pre>
    11:11:07 &lt;nox&gt; wow it 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, it doesn't appear to be a bitness issue, as it occurs
                    in 32- and 64-bit modes.  That 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 a jsfiddle where you can view this solution in action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that uses a large centered background image, which naturally loads
I have a sprite sheet which has each image centered in a 32x32 cell.
I have a page that I want centered, with a background and a border
I have a vertical layout that I want to remain centered on the page.
I have a big image, and some text that I would like to lay
The <center>Text</center> tag to have text centered horizontally is depreciated, so I tried <p
I have a website that is perfectely centered aligned. The CSS code works fine.
I have a System.Drawing.Image that I would like to use as the centered portion
I have a table, one column of which contains only a checkbox and I
I want to have one table header be centered over two table columns side

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.