Add class to Field method

Hi,

I am strugling with the following thing:
When I do the following, my styling breaks (because an extra paragraphs comes in):

        <div class="Hero--Subtitle">
          <p class="lead"><?= $data->heroText()->kt() ?></p>
        </div>

I know that I can make use of another to field method (for example: <?= $page->text()->kt() ?>) but then I miss the enters from the text. So I want make use of ‘Converts the field content from Markdown/Kirbytext to valid HTML’. But then add my “lead” class.

Hope someone can help me.

Thanks in advance!

Add the second class at the div and change your css-file also. Then you did not need the class at the p-tag.

css

.lead p {
// your css
}

Sorry, on my phone I cannot find the needed ticks.:disappointed_relieved:

2 Likes

Thanks for your superfast reply :slight_smile: it solved my problem!

Enjoy your day!