InterviewHubPRO
Section Overview
Q376

Question 376 of 521

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

72%
JavaScript Internals (521 Qs)•Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

Is it possible to add CSS to console messages

Yes, you can apply CSS styles to console messages similar to html text on the web page.

javascript
  console.log(
    "%c The text has blue color, with large font and red background",
    "color: blue; font-size: x-large; background: red"
  );

The text will be displayed as below,

Screenshot

Note: All CSS styles can be applied to console messages.