DEV Community

alɔeksandyr
alɔeksandyr

Posted on

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

Top comments (0)