Skip to main content
Participant
December 28, 2009
Answered

Styling first element

  • December 28, 2009
  • 1 reply
  • 327 views

By using  <?php echo htmlspecialchars($row_rsDetails['part1']); ?> I got the text out of a mysql-database table. Now I would like to style the first letter of the first paragraph (<span class="dropCap"), but I cannot imagine how to apply it in a php-rule. How should I manage that?

Leo

This topic has been closed for replies.
Correct answer David_Powers

Use the PHP function substr() to extract the substring:

<span class="dropCap"><?php echo substr($row_rsDetails['part1'], 0, 1); ?></span>

<?php echo htmlspecialchars(substr($row_rsDetails['part1'], 1)); ?>

1 reply

David_Powers
David_PowersCorrect answer
Inspiring
December 28, 2009

Use the PHP function substr() to extract the substring:

<span class="dropCap"><?php echo substr($row_rsDetails['part1'], 0, 1); ?></span>

<?php echo htmlspecialchars(substr($row_rsDetails['part1'], 1)); ?>

Participant
December 28, 2009

Thank you very much - that has been far beyond my knowledge.

Leo