Jump to content

Adding something before a first-letter element?


L.Adlon

Recommended Posts

Here's a weird one...

 

Is there a way to code it so that you can insert some text before the 'first letter' of a paragraph?

 

(Ya, I know, then that part is not the 'first letter'.... sure, you got me there.... but bear with me here!)

 

The reason I make such a strange request is because I'm using first-letter to make the first letter of each paragraph larger (like a storybook effect).... BUT, in cases where I have quotes around that paragraph (such as in a testimonial) the open quote ends up getting affected, since it is... the first letter.

 

I'd want the paragraph in quotes, but technically the SECOND character (the first actual letter) to be affected.

 

I suppose I could just do it with a direct <span> type thing, although you loose the keen automation of something like the first-letter definition.

 

 

I kind of need a 'second-letter' attribute.

Link to comment
Share on other sites

CSS doesn't have any way to select the second letter, but you could choose to omit the quotes and use the :before and :after selector to put them.

p.quoted:before, p.quoted:after{    content: '"';}p.quoted:first-letter {    font-size: 4em;}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...