Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

wrapping pre inside table cell

I use the latest twitter bootstrap and I have some troubles with pre tag inside table cells, if line is too long it should create horizontal scroll but it won't happen.

http://jsfiddle.net/52VtD/6958/ example without pre

<div class="row">
    <div class="container">
        <div class="col-md-3" style="border: 1px solid red;">
            this is col-md-3? yes :)
            <table class="table">
                <thead>
                    <tr><th>author</th><th>content</th></tr>
                </thead>
                <tbody>
                    <tr><td>somebody</td><td></td></tr>
                </tbody>
            </table>
        </div>
        <div class="col-md-9" style="border: 1px solid black;">test</div>
    </div>
</div>

http://jsfiddle.net/52VtD/6959/ example with pre

<div class="row">
    <div class="container">
        <div class="col-md-3" style="border: 1px solid red;">
            this is col-md-3? no :(
            <table class="table">
                <thead>
                    <tr><th>author</th><th>content</th></tr>
                </thead>
                <tbody>
                    <tr><td>somebody</td><td>why I cannot wrap it?<br/><pre>&lt;?php<br/>class A<br/>{<br/>    function foo()<br/>    {<br/>        if (isset($this)) {<br/>            echo '$this is defined (';<br/>            echo get_class($this);<br/>            echo &quot;)\n&quot;;<br/>        } else {<br/>            echo &quot;\$this is not defined.\n&quot;;<br/>        }<br/>    }<br/>}<br/><br/>class B<br/>{<br/>    function bar()<br/>    {<br/>        // Note: the next line will issue a warning if E_STRICT is enabled.<br/>        A::foo();<br/>    }<br/>}<br/><br/>$a = new A();<br/>$a-&gt;foo();<br/><br/>// Note: the next line will issue a warning if E_STRICT is enabled.<br/>A::foo();<br/>$b = new B();<br/>$b-&gt;bar();<br/><br/>// Note: the next line will issue a warning if E_STRICT is enabled.<br/>B::bar();<br/>?&gt;</pre></td></tr>
                </tbody>
            </table>
        </div>
        <div class="col-md-9" style="border: 1px solid black;">test</div>
    </div>
</div>

I have no idea what I can do, I tried many times with css properites.

like image 238
UnknownError1337 Avatar asked Feb 12 '23 12:02

UnknownError1337


1 Answers

try to use:

<pre><code> your example code here </code></pre>
like image 106
Davide_sd Avatar answered Feb 16 '23 02:02

Davide_sd