Skip to content

Instantly share code, notes, and snippets.

@peterhry
Created July 18, 2014 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterhry/019372e1b4e0efaed11d to your computer and use it in GitHub Desktop.
Save peterhry/019372e1b4e0efaed11d to your computer and use it in GitHub Desktop.
jQuery Dropcaps - The CSS pseudo selector approach is too buggy. I’m using jQuery to wrap the first char in a style-able <span> instead.
$(document).ready(function () {
var p1 = $('.post-intro p').eq(0),
text = p1.text();
p1.html('<span class="dropcap">' + text.substr(0,1) + '</span>' + text.substr(1));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment