HTML cropping graphics to the end

I have a tag prewith some code in it that does not wrap the string. I want to put a border ( border:1px solid Black;) around it , but the border is limited by the width of the browser, regardless of the length of the text. How to make the border always expand to contain all the text in the tag pre?

Here is the code I'm using:

<pre style="border:2px solid Black;">@Model.Code()</pre>
+3
source share
3 answers

Try adding CSS display: inlineto the tag pre.

+2
source

Using:

<pre style="display: inline-block; border:2px solid Black;">
+5
source

,

pre { white-space:pre-wrap }

pre { white-space:pre-line }

pre-line , pre-wrap .

, , , .

pre {
    white-space:pre-line;
    border:2px solid black
}

?

+3

All Articles