在HTML / CSS中显示“代码”部分的正确方法?

时间:2017-04-23 02:50:41

标签: html css

是否有“最佳方式”。是什么让这部分代码看起来插入?

例如,SO如何在帖子上显示“代码”部分?例如?

我知道Bootstrap有“Wells”但是当没有使用它时,是否有一种特殊的功能看起来不错?

1 个答案:

答案 0 :(得分:2)

您可以使用标记precode来处理此类事件。



code { 
    background: rgba(0,0,0,.2)
}

pre {
    white-space: pre-wrap;
    background: rgba(0,0,0,.2)
}

The <code>&lt;code&gt;</code> tag.

<pre>
Here's a  &lt;pre&gt; tag. some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text some more text 
</pre>
&#13;
&#13;
&#13;