Home  >  Article  >  Web Front-end  >  如何实现代码的关键词自动变色

如何实现代码的关键词自动变色

ringa_lee
ringa_leeOriginal
2018-05-14 14:28:342638browse

HTML CSS

如同CSDN论坛中这种显示方式,让代码的关键词自动变色,并且显示行号,是如何实现的?  
 
例子:  

<html><head></head><body></body></html>

 
我查看过了源代码,使用的

标签,但是css代码是如何写的呢,怎样判断哪些词是代码中的关键词呢?我找了好久都没找到。知道答案的人能否告诉我一下。

回复讨论(解决方案)

google一下Highlight.js

google一下Highlight.js  
谢谢你,我使用SyntaxHighlighter实现了!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn