How can CSS be integrated with PHP to style text output from a database?
When outputting text from a database using PHP, you can integrate CSS styles by wrapping the text in HTML tags with inline styles or by applying classes to the elements and linking to an external CSS file. This allows you to control the appearance of the text dynamically based on the data retrieved from the database.
<?php
// Assume $text is the variable containing text retrieved from the database
echo "<div style='color: red; font-size: 16px;'>$text</div>";
// OR
echo "<div class='styled-text'>$text</div>";
?>
Related questions
-
PHP function parameters
-
Encryption PHP sensitive data
-
SQL queries optimization limit