I want to display the first character in a paragraph with a drop cap. It works fine with normal text or setting it with js, but when I use an entry field it doesn't pull out the first character. The code looks like this:
// css
p.dropcap {
float: left;
font-size: 4em;
…
}
// html
<p class='dropcap'>{{ entry.body }}</p>
The first letter isn't dropped, but if I change the html to:
<p class='drop cap'>This is {{ entry.body }}</p>
The T is dropped as expected.
Any ideas on how to fix this?
body
? If it's a rich text field, then your first character is likely a<
, not a letter.