Employ the border-radius property to produce images with rounded corners.

Example
Rounded Image:
| img { border-radius: 8px; } |

Example
Circled Image:
| img { border-radius: 50%; } |
Utilize the border property to generate thumbnail images.
Thumbnail Image:

Example
|
img { |

Example
|
img { |
Responsive images adapt dynamically to match the dimensions of the screen.
Adjust the browser window size to observe the impact.

To ensure that an image can shrink as needed but won’t enlarge beyond its original dimensions, include the following:
Example
| img { max-width: 100%; height: auto; } |
Example
| img { display: block; margin-left: auto; margin-right: auto; width: 50%; } |

Example
| div.polaroid { width: 80%; background-color: white; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); } img {width: 100%} div.container { text-align: center; padding: 10px 20px; } |
The opacity property accepts values ranging from 0.0 to 1.0. A lower value indicates greater transparency.

Example
| img { opacity: 0.5; } |
How to place text over an image:
Example

The CSS filter property applies visual effects such as blur and saturation to an element.
Please note that the filter property is not supported in Internet Explorer or Edge 12.
Example
Convert all images to grayscale by changing their color to 100% black and white.
| img { filter: grayscale(100%); } |

Generate a hover effect with an overlay.

Hover your mouse cursor over the image.

Example
| img:hover { transform: scaleX(-1); } |
CSS can be employed to construct image galleries. This example utilizes media queries to adjust the arrangement of images based on varying screen sizes. Resize the browser window to observe the impact.

Example
| .responsive { padding: 0 6px; float: left; width: 24.99999%; } @media only screen and (max-width: 700px){ .responsive { width: 49.99999%; margin: 6px 0; } } @media only screen and (max-width: 500px){ .responsive { width: 100%; } } |
This example showcases the collaboration between CSS and JavaScript.
Initially, CSS is utilized to craft a modal window (dialog box), which is hidden by default.
Subsequently, JavaScript is employed to reveal the modal window and to showcase the image within it, upon a user clicking on the image.

Example
|
// Get the modal |