如何在一个网页缩进显示源代码code? HTML? CSS? [英] How to display source code with indent in a web page? HTML? CSS?
问题描述
我想展示一些源$ C $ C上一个WinForm WebBrowser控件。我想装饰源$ C $ c。与HTML标记,如颜色,字体和大小。但我发现很难显示的缩进正常。
I want to show some source code with the WebBrowser control on a winform. And I want to decorate the source code with HTML tags, such as color, font, and size. But I found it difficult to display the indent properly.
要为precise,我的消息来源$ C $ C在的String []举行,每个String保持适当的缩进(空格或制表符)了。但似乎这些种类的缩进都只是按WebBrowser控件忽略
To be precise, my source code are held in String[], and each String holds the proper indent (space or tab) already. But it seems these kinds of indent are just ignored by the WebBrowser control.
有人能告诉我怎么样?
推荐答案
的 < pre>
元素(使用的 < code>
元素与相应的类名的标记出部分要语法高亮显示)
The <pre>
element (using <code>
elements with appropriate class names to mark up the parts you want to syntax highlight)
<pre><code class="javascript"><code class="keyword">function</code> <code class="name">foo</code>()…
这篇关于如何在一个网页缩进显示源代码code? HTML? CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!