pre

How can I remove leading whitespace in my <pre>/<code> block without removing indentation in my HTML? [duplicate]

喜你入骨 提交于 2019-12-03 12:16:48
问题 This question already has answers here : How to preserve whitespace indentation of text enclosed in HTML <pre> tags excluding the current indentation level of the <pre> tag in the document? (10 answers) Closed 4 years ago . I have the following HTML: <body> Here is some code: <pre><code> Here is some fun code! </code></pre> </body> But when I preview it, because the code is indented, the pre is all out of whack. I can fix that by bringing the contents back against the indent, but it looks

Rails 3.1 on Ubuntu 11.04 via RVM - uninitialized constant Psych::Syck

拈花ヽ惹草 提交于 2019-12-03 09:30:19
gem install rails --pre ERROR: While executing gem ... (NameError) uninitialized constant Psych::Syck I can't seem to find any info on how to resolve this. Has anyone else had the same problem? I am using a newly created gemset in RVM with Ruby 1.9.2 I had exactly same problem on mac via RVM. Specifying version is the rescue for me. gem install rails --pre --version 3.1.0.rc1 update (2011-06-12) with rubygems 1.8.4, I can install rails 3.1.0.rc4 without specifying the version. I had exactly the same problem, and the other solutions mentioned here didn't work for me. However, this did: gem

Is it possible to make any CSS element behave like <pre>

爱⌒轻易说出口 提交于 2019-12-03 09:17:48
I am loading some content inside an iframe. I want this content to behave as-if it was inside a <pre> tag - namely for it to respect line breaks. I am using javascript to set the style of the body element of this iframe. I am wondering if it would be possible to set a particular style that will cause the body of this iframe to act like it's inside <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

How can I remove leading whitespace in my <pre>/<code> block without removing indentation in my HTML? [duplicate]

落花浮王杯 提交于 2019-12-03 01:48:38
This question already has an answer here: How to preserve whitespace indentation of text enclosed in HTML <pre> tags excluding the current indentation level of the <pre> tag in the document? 10 answers I have the following HTML: <body> Here is some code: <pre><code> Here is some fun code! </code></pre> </body> But when I preview it, because the code is indented, the pre is all out of whack. I can fix that by bringing the contents back against the indent, but it looks silly. Can I make that above text look non-indented? You could try this maybe: pre, code{ white-space:normal; } Fiddle Here you

How to make Twitter Bootstrap's <pre> blocks scroll horizontally?

怎甘沉沦 提交于 2019-12-03 01:34:19
问题 Per the examples https://getbootstrap.com/docs/4.3/content/code/#code-blocks, bootstrap only supports vertically-scrollable and word-wrapped <pre> blocks out of the box. How do I make it so that I have horizontally-scrollable, unwrapped code blocks instead? 回答1: 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

PHP code to syntax-format XML content in a `pre` tag

南楼画角 提交于 2019-12-02 18:01:32
问题 I'm looking for way to format the XML syntax displayed in a pre tag on my sandbox web. If you know how, please show me. 回答1: You can have a look at Hyperlight or GeSHi (in PHP). Perhaps you'd prefer to use a Javascript script: consider this list . 回答2: If you want syntax highlighting then this is the only script / plugin you need -> http://alexgorbatchev.com/SyntaxHighlighter/ This is javascript though and will format it within the browser 来源: https://stackoverflow.com/questions/8008578/php

How to make Twitter Bootstrap's <pre> blocks scroll horizontally?

二次信任 提交于 2019-12-02 15:03:48
Per the examples https://getbootstrap.com/docs/4.3/content/code/#code-blocks , bootstrap only supports vertically-scrollable and word-wrapped <pre> blocks out of the box. How do I make it so that I have horizontally-scrollable, unwrapped code blocks instead? 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; } Matt Morey This worked for me: pre { overflow-x: auto; } pre code { overflow-wrap: normal; white

Using only CR as linebreak inside pre tag doesn't work

本秂侑毒 提交于 2019-12-01 04:29:14
问题 At work, we stumbled upon Bugzilla creating HTML output that led to lines much too long because the browser didn't break the lines. This was happening on Chrome, but not on Firefox 3.5, so we didn't really care. But Firefox 4 behaves just like Chrome, so we had to find another workaround. An example is: <html> <body> <pre> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et

HTML <pre> tag causes linebreaks

女生的网名这么多〃 提交于 2019-11-30 05:00:49
I'm using CSS (via JQuery , but not relevant to this question) to highlight certain elements within an HTML file: I'm using "pre" tags to separate out logical elements in my file, but I noticed that "pre" tags seem to leave newlines between elements. Can I get rid of these using CSS ? (Or what shall I use instead of "pre" tags? The text elements may contain HTML elements themeselves : which should not be rendered, and should be shown literally as source-code: hence my initial choice with "pre" tags) Here's an example of the HTML I'm using: (Requires http://docs.jquery.com/Downloading_jQuery

How can I display html tags inside an HTML document?

早过忘川 提交于 2019-11-29 17:20:53
问题 I simply want to create something like that: <strong>blah blah</strong> I've been trying to do this for a long time though for some reason whenever I put the code and the pre tags they don't do what they should. They do unformat the content - I don't see any formatting, though the tags don't appear. For example, I wrote : <pre><b>abc</b></pre> The abc is appearing not bold, but I can't see the tag itself. How can I do that? I don't want to use entities like &fdaf; because I am not writing the