How to Style console.log?

ippatev

Aleksandr Ippatev

Posted on August 10, 2021

How to Style console.log?

To add CSS styling to the console output, we use the CSS format specifier %c. Then we start the console message, which is usually a String with the specifier followed by the message we intend to log, and, finally, the styles we want to apply to the message:

console.log("%cThis is a green text", "color:green");
Enter fullscreen mode Exit fullscreen mode

screenshots

💖 💪 🙅 🚩
ippatev
Aleksandr Ippatev

Posted on August 10, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

How to Style console.log?
javascript How to Style console.log?

August 10, 2021