OPopp
March 1, 2024, 2:57pm
1
Hello!
I am wondering. How can I style some text that I get through kirbytext() from a textarea field?
I am using tailwind an it doesnt apply non of my textstyles.
<p class="text-sm text-pink"><?= $page->foerdervereininfo_text()->kt() ?></p>
Anyone got a hint in which direction to look?
Thank you!
Herewith…
<p class="text-sm text-pink">
<?= $page->foerdervereininfo_text()->kt() ?>
</p>
…you will enclose the text block with an additional <p>
tag, which is undesirable in your case.
<p class="text-sm text-pink">
<p>This is my textblock</p>
</p>
Add inline() to the output:
<p class="text-sm text-pink">
<?= $page->foerdervereininfo_text()->kt()->inline() ?>
</p>
1 Like
See Kirby meets Tailwind CSS | Kirby CMS
This still has shortcomings if you want to apply extra classes to particular parts within the text.
So you either need to add your tags/classes directly in Markdown, or use Kirbytags for these text parts.
Inlining kirbytext as proposed by @GB_DESIGN only makes sense for single lines of text, not for text spanning multiple p tags.
2 Likes
OPopp
March 1, 2024, 3:10pm
4
Great. Thanks for the input!