html - CSS: container to show PRE tag with scroll bars -


I have some server-side code which can be found in html & lt; Pre & gt; & Lt; / Pre & gt; tag and I would like to put them in a container with scroll bars (in particular, table cells - with equal width). Obviously, I'm going to & lt; Pre & gt; I want to preserve the tag whitelisting format.

():

HTML:

  & lt; Table & gt; & Lt; TR & gt; & Lt; Th & gt; Colonel 1 & lt; / Th & gt; & Lt; Th & gt; Colonel 2 & lt; / Th & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Pre & gt; Function This Ietsat (Blaise) test (123456789 test 123456789 test 123456789}  & lt; / td> & lt; td & gt; & lt; pre & gt; function this iSatat (blah) (Test 123456789 test 123456789 test 123456789}       

CSS:

  table {width: 100%; border: 1px solid red;} TD {width: 50%; overflow: scroll; border: 1px solid blue;}  < / pre> 

Enter image details here

(I call it firefight I'm testing in OX) What am I doing wrong? Thanks

update < p> The easiest way to fix this is: table-layout: fixed (ironically) table


< The basic answer for CSS for p> is to use the table elements within the

pre elements, which is very difficult to calculate relative width Because of issues with which scrolls and actual f Throw the bread out correctly. As such, I'm going to avoid a table based setup, at least not because you are not even displaying tabular data (Aha semantic!).

I will change the following layouts:

HTML

  & lt; Div class = 'container' & gt; & Lt; Div class = 'col' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; Div class = 'col' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

css

  * {box size: border-box; } Html, body {margin: 0; Padding: 0; }. Container {boundary: 1px solid red; Hidden flurry; } .col {boundary: 1 px solid blue; Swim left; Width: 50%; Overflow: Auto; }   

update

for a duplicate (line) table layout, div element dislpay Use as appropriate:

HTML

  & lt; Div class = 'table' & gt; & Lt; Div class = 'row' & gt; & Lt; Div class = 'cell' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; Div class = 'cell' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = 'row' & gt; & Lt; Div class = 'cell' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; Div class = 'cell' & gt; & Lt; Pre & gt; Function this ietsat {bla} {test 123456789 test 123456789 test 123456789} & lt; / Pre & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

css

  * {box size: border-box; } Html, body {margin: 0; Padding: 0; } .table {border: 1px solid red; Display: Table; Table layout: fixed; Width: 100%; } .cel {border: 1 px solid blue; Overflow: Auto; Performance: table cell; } .row {display: table-row; }    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -