How can I style code listings using CSS?

后端 未结 6 1672
生来不讨喜
生来不讨喜 2021-01-29 23:56

I\'d like to display snippets of programming language code, and also HTML code, inside an HTML document using CSS. I want it to be indented and in fixed-width font... I\'m think

6条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-30 00:46

    Well, you could try using a

     tag in your blockquote to preserve the formatting first, and then use a monospaced font, like courier for the css style.

    Something like this would work in the css:

    pre {
      font-family:     "Courier New"
                        Courier
                        monospace;
    }
    

提交回复
热议问题