Languages
[Edit]
EN

JavaScript - style console.log()

3 points
Created by:
p_agon
589

In this article, we would like to show you how to style console.log() in JavaScript.

Quick solution:

Where %c directive sets color: red style for the following text.

 

Practical example

Edit

In this example, we use the %c directive to apply multiple CSS styles to console output.

Result:

JavaScript - style console.log
JavaScript - style console.log

See also

Edit
  1. JavaScript - display security warning in web browser console (styled console.log) 

References

Edit
  1. console - Web APIs | MDN

Alternative titles

  1. JavaScript - style console log message
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join