5

I was asking a question on Stack Overflow, and I needed to insert a Stack Snippet. The snippet only logged one thing to the console. The console only took a little bit of the screen; the rest of the screen was left unused.

I was wondering, is there any way to make the Stack Snippet console-only?

1

1 Answer 1

9

The console within Stack Snippets is rendered inside the output, so it can be manipulated using CSS.

A one-liner like this hides the normal output and shows nothing but the console:

.as-console-wrapper { max-height: 100% !important; top: 0; }

console.log("Only the console is shown here.");
console.log(JSON.stringify(Array.from("Hello, world!"), null, 2));
.as-console-wrapper { max-height: 100% !important; top: 0; }


Comparison without .as-console-wrapper:

console.log("Only the console is shown here.");
console.log(JSON.stringify(Array.from("Hello, world!"), null, 2));

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .