0

In EE2.9 (can go up) is it possible to target the first paragraph of text in a channel entry? I want to add a class only to this first paragraph for a CSS3 drop cap to the text.

Thanks in advance for any help on this.

Justin

3
  • So it would be a text area and /* p:first-child:first-letter { float: left; color: #903; font-size: 75px; line-height */ would a sample of the CSS. The CSS isn't the problem it's figuring out the EE side, but I guess what your saying is there is no EE side to this. – jsuissa Sep 27 '15 at 9:05
  • Without wrapping your EE variable tag in a custom plugin that parses the text identifying the first paragraph tag in PHP and adding the relevant class, there's no way to do it (as @jrothafer has mentioned). But depending on how your text held in ExpressionEngine, you could view source and add the class in the wysiwyg editor, or if using a third-party fieldtype like Wygwam, you can add classes to specific paragraphs through styles. – Peter Lewis Sep 27 '15 at 14:32
  • Unless there was a parameter available for the channel entry then it is much more of the CSS question as I'm trying to highlight the first three words of a paragraph without having to do any manual formatting because of the sheer number of pages.specifically I want to capitalize the first three words which I have almost have a decent solution in place already, but the contributions here have been very helpful. Just hoping there was something simpler In EE to trigger that CSS. – jsuissa Sep 27 '15 at 20:16
0

It really depends on what your output field is. Is it a text area? A rich text area? WYGWAM field? Answer that question and I can hone in. But here is an example CSS selector:

.channel-entries .field-id-666 p:first-of-type {

    /* your CSS rules go here */

}

Note that I don't actually know the class names off the top of my head, but a :first-of-type selector sounds like your answer.

Also note this isn't an EE related question really, but it's just close enough to not flag :P

1
  • Thanks so much, unfortunately there is no multi-word CSS selector that I'm aware so it would require jQuery too. Best bet seems to be to do it manually with a b or a strong tag. – jsuissa Sep 27 '15 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.