Question

How do I use javascript to black out all content except a single html element?

This is Chrome-specific app so CSS3 can be used.

Was it helpful?

Solution

Use one <div> with position: fixed; that covers the page, with something like background-color: rgba(0, 0, 0, .5);, then simply place the element you wish to show on top of that.

OTHER TIPS

You could iterate through all the elements of a document and set their background color to black, except the one with a certain ID.

You don't need CSS3 for this at all.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top