HomeToolsBlog


CSS Grayscale Generator BETA

Configuration

Grayscale

Class

Preview

Parliament of Hungary, Budapest

Code

CSS Grayscale Generator

In CSS, you can apply the grayscale effect to elements, such as images or text, using the filter property. The grayscale effect converts the colors of an element to shades of gray, giving it a black-and-white appearance.

Here's how you can apply the grayscale effect in CSS:

.grayscale-element { filter: grayscale(100%); }

in this example:

  • The .grayscale-element class applies the grayscale effect to the element it targets.
  • grayscale(100%) specifies that the element should be fully grayscale, meaning that all colors are converted to shades of gray.

Here's another example with partial grayscale:

.partial-grayscale-element { filter: grayscale(50%); }

In this case, the partial-grayscale-element class applies a 50% grayscale effect, allowing some color to show through.

The filter property can be used to apply various other visual effects as well, and it's a versatile tool for enhancing the appearance of elements on your web page. Keep in mind that browser support for the filter property may vary, so it's important to test the effect in different browsers to ensure compatibility.


Top tools

Code Hub
Color PaletteNEW
Strong Password GeneratorColor PickerSocial Media Username Checker

Select Language:

© 2024 ReadyTools. All rights reserved.