How can I remove leading whitespace in my / block without removing indentation in my HTML? [duplicate]
You could try this maybe: pre, code{ white-space:normal; } Fiddle
You could try this maybe: pre, code{ white-space:normal; } Fiddle
While the font-size cannot be changed for text directly inside pre tags, you can always wrap that text in another element (a span, for example) and change the font size of that element. For example (this is inline-styles, but could be put in CSS if you wanted): <pre><span class=”inner-pre” style=”font-size: 11px”> Blah blah Multiple lines … Read more
<pre> PrimeCalc calc = new PrimeCalc(); Func<int, int> del = calc.GetNextPrime; </pre>
There are a few solutions: The simplest is to place line breaks in the text. This probably is not what you want though, since it will either leave large right margins or still cause scroll bars, unless the browser window is just the right size. Another is to use white-space:pre-wrap; in the CSS for your … Read more
Indenting With Comments Since browsers ignore comments, you can use them to indent your pre tag contents. Solution <html> <body> <main> Here is my code with hack: <pre> <!– –>def some_function <!– –> return ‘Hello, World!’ <!– –>end </pre> Here is my code without hack: <pre> def some_function return ‘Hello, World!’ end </pre> </main> <body> … Read more
The trick is that bootstrap overrides both the white-space and the CSS3 word-wrap attributes for the <pre> element. To achieve horizontal scrolling, ensure there’s this in your CSS: pre { overflow: auto; word-wrap: normal; white-space: pre; }
you can find the default setting or how they’re suppose to be at http://www.w3.org/TR/CSS2/sample.html just apply the same style to the element you want to behave as a pre element and voila you’re done p.s. which is basically pre{ white-space: pre ; display: block; unicode-bidi: embed }
You can use the xmp element, see What was the <XMP> tag used for?. It has been in HTML since the beginning and is supported by all browsers. Specifications frown upon it, but HTML5 CR still describes it and requires browsers to support it (though it also tells authors not to use it, but it … Read more
Use white-space: pre to preserve whitespace preformatting as in the pre element. To go a step further, also add font-family: monospace, as pre elements are typically set in a monospace font by default (e.g. for use with code blocks). .preformatted { font-family: monospace; white-space: pre; } <div class=”preformatted”> Please procure the following items: – Soup … Read more
To insert tab space between two words/sentences I usually use   and