How to do bold and simple text in the same line using the echo in php?


In order to get bold text, you need to use font-weight and to get the simple text you can use <span> tag. All this gets added in the echo.

Example

The PHP code is as follows

 Live Demo

<!DOCTYPE html>
<html>
<body>
<?php
echo '<span style="font-size: 20px; color: #006400; font-weight: bold;">This is my first PHP Program</span> '.$row['data'];
?>
</body>
</html>

Output

Here is the snapshot of sample output.

This is my first PHP Program

Updated on: 13-Oct-2020

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements