How to capitalize the first letter of a paragraph with jquery but no symbols? -


in worpdress blog using following jquery code wrap first letter in span tag can style bigger appearance:

$(".single .the_content p:first")   .each(function () { var el = $(this), replace(/\b[a-z]/g, text = el.html(), first = text.slice(0, 1), rest = text.slice(1); el.html("<span class='capital'>" + first + "</span>" + rest); }); 

it's works ok but, when insert image not display because first symbol of image insert code "<" i'ts wrapped in span tags, so, how can apply letters z ?

here's example style first letter of series of paragraphs larger appearance , float left, similar style seen in magazines.

p:first-child:first-letter {     font-size: 5em;     float: left;     padding: 0 10px 10px 0;     text-transform: uppercase; } 

demo: http://jsfiddle.net/jrthib/du4qv/1/

reference: http://css-tricks.com/almanac/selectors/f/first-letter/


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -