Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML pre no line wrap border

Tags:

html

css

border

I have a pre tag with some code in it that doesn't line wrap. I want to put a border around it (border:1px solid Black;), but the border is limited to the width of the browser, regardless of the length of the text. How can I force the border to always extend to contain all the text in the pre tag?

Here's the code I'm using:

<pre style="border:2px solid Black;">@Model.Code()</pre>
like image 230
Entity Avatar asked Dec 07 '22 21:12

Entity


1 Answers

Use:

<pre style="display: inline-block; border:2px solid Black;">
like image 96
DanielB Avatar answered Dec 23 '22 12:12

DanielB