Luc Gerrits

Bootstrap HTML/CSS code block formatter

What is it?
If you need to paste some code into a website based on the Bootstrap project, this is a solution. Here is an example and its css .


What it looks like on your website:

echo Hello world!

The CSS code used is:

<style type="text/css">
pre {
  font-family: monospace;
  background-color: #fff;
  margin: 1em auto;
  padding: 0.5em;
  border-radius: .25em;
  box-shadow: 0.1em 0.1em 0.5em rgba(0, 0, 0, 0.45);
  line-height: 0;
  counter-reset: line;
pre span {
  display: block;
  line-height: 1.5rem;
pre span:before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  border-right: 1px solid #ddd;
  padding: 0 .5em;
  margin-right: .5em;
  color: #888;
Thanks Ole Bertram for the help.