Code Highlight CSS Style

 Here is a CSS style that you can use to highlight code:



pre {

  background-color: #f5f5f5;

  border: 1px solid #ccc;

  border-radius: 4px;

  font-family: monospace;

  font-size: 12px;

  line-height: 1.5;

  overflow: auto;

  padding: 10px;

}


pre code {

  background-color: transparent;

  border-radius: 0;

  color: #333;

  display: block;

  padding: 0;

}


This CSS style adds a background color, border, and padding to the pre element, which is used to display preformatted text. It also adds a color to the code inside the pre element. This will highlight the code and make it easier to read.


You can customize this style to suit your needs by changing the colors, font, and other properties. For example, you can add syntax highlighting by styling different types of code elements (e.g. keywords, strings, comments) with different colors.





0 comments:

Post a Comment