-2

I want to give style in my echo tag in php for example echo 'hello world';

if i want the text to be bold or color yellow so how do i give style to this? Ans me the right solution not the shortcut Thanks.

Abdul Rehman Khan
  • 162
  • 1
  • 4
  • 23
  • Possible duplicate of [How to style PHP echo output with span](http://stackoverflow.com/questions/13210552/how-to-style-php-echo-output-with-span) – Abdul Rehman Khan Mar 20 '17 at 08:36

3 Answers3

1

You can try this:

<?php echo '<span class="heading">Hello World!</span>' ?>

<style>
 .heading{color:red;}
</style>
Bhumi Patel
  • 569
  • 4
  • 13
1
echo '<span style="font-weight: bold; color: yellow;">hello world</span>';
Md Mahfuzur Rahman
  • 2,319
  • 2
  • 18
  • 28
0

You can generate the HTML according to your requirements.

For e.g.

echo "<b>Hello World</b>"; // Bold text
echo "<i>Hello World</i>"; //Italics text

echo "<div style='text-color:blue;'>Hello World</div>" ; //Blue colored text

There are many other ways you can thave this. Try to generate the correct HTML and CSS.

Ayush
  • 741
  • 9
  • 19