We've just installed Prism.js and got it working.

In this screencast we find a theme called the Tomorrow Theme and ingrate it's colors into the syntax highlighting. We make a little color key at the top of the file for quick reference. We also make some guesses as to what is what, at least to start. What we end up with, color wise, is OK but not spectacular. If you browse around the site today, you'll notice the color theme is more like Twilight, which I used to love in TextMate and I'm currently loving in Sublime Text 2.

We finish up by adding the header bars to code snippets. We don't have actual markup do this (which is probably good, it's mostly just a decorator) we add it through using a pseudo element and generated content via the rel attribute on the code. Most of the existing code on CSS-Tricks has this attribute. If it doesn't, not a big deal. We aren't really using rel in the correct way here, but I'm not overly worried about it.

pre[rel]:before {
  content: attr(rel);
}

We run into a little problem with making that pseudo element 100% wide with padding. Turns out our box-sizing declaration on the * selector doesn't affect pseudo elements (kinda makes sense), so we update our Normalize to include that.

Comments

  1. User Avatar
    brendan
    Permalink to comment#

    Im pretty sure I read this on your blog… wasn’t the problem that the universal selector that you used to apply box sizing doesn’t apply to ::before and ::after unless you do *::before and *::after ??

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

Submit a Comment

icon-closeicon-emailicon-linkicon-menuicon-searchicon-tag