Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use CSS’s opacity property on an <img> element or a class applied to it. A value of 1 is fully opaque, 0 is fully transparent, and values between them create translucency.

<img class="photo" src="photo.jpg" alt="Description of the photo">
.photo {
  opacity: 0.6;
}

HTML provides the image; CSS controls how transparent it appears. The sections below show static transparency, hover fades, background-only transparency, accessibility safeguards, and the behavior that often surprises developers.

Set a fixed opacity on an image

Assign a class to the image and set opacity in your stylesheet:

<img class="photo" src="photo.jpg" alt="A mountain at sunrise">
.photo {
  opacity: 0.6;
}

Opacity accepts numbers from 0 through 1. The same range can be written as percentages, such as 60%. A value of 0 makes the rendered image invisible, 0.5 makes it half-opaque, and 1 leaves it unchanged. Values below zero or above one are clamped to the valid range.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Complete example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Transparent image</title>
  <style>
    .photo {
      display: block;
      max-width: 100%;
      opacity: 0.6;
    }
  </style>
</head>
<body>
  <img class="photo" src="photo.jpg" alt="A mountain at sunrise">
</body>
</html>

The image still occupies its normal layout space. Opacity changes the pixels that are composited, not the image dimensions.

Fade an image on hover

For a pointer-triggered fade, define an initial state, a transition, and a :hover state:

.photo {
  opacity: 1;
  transition: opacity 200ms ease;
}

.photo:hover {
  opacity: 0.5;
}

The transition interpolates between the two values over 200 milliseconds. Without transition, the image changes immediately when the pointer enters or leaves it.

Include keyboard focus

Hover is not available to keyboard users and has no consistent equivalent on touch devices. If the fade communicates an action, make the image a link or button and style its focus state as well:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<a class="photo-link" href="/gallery">
  <img class="photo" src="photo.jpg" alt="Open the gallery">
</a>
.photo-link .photo {
  opacity: 1;
  transition: opacity 200ms ease;
}

.photo-link:hover .photo,
.photo-link:focus-visible .photo {
  opacity: 0.5;
}

.photo-link:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 4px;
}

Do not hide essential information exclusively on hover. Put the same information in visible text, an accessible label, or an activated state.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Respect reduced-motion preferences

A fade is motion, even though it is brief. Users who request reduced motion should not be forced to watch it:

@media (prefers-reduced-motion: reduce) {
  .photo-link .photo {
    transition: none;
  }
}

Choose between whole-image and background-only transparency

opacity applies to the element as a whole, including its descendants. If you set opacity on a card, its image, text, icons, and other children all become translucent together.

.card {
  opacity: 0.7;
}

When only the background should be translucent while text remains fully opaque, use an alpha color instead:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
.card {
  background: rgb(0 0 0 / 40%);
  /* Older syntax: background: rgba(0, 0, 0, 0.4); */
  color: white;
}

This distinction matters for overlays, captions, navigation panels, and cards. Fading the container can make text difficult to read; an alpha background preserves the foreground content.

Overlay example

<figure class="hero">
  <img src="hero.jpg" alt="Coastal cliffs">
  <figcaption>Coastal cliffs at low tide</figcaption>
</figure>
.hero {
  position: relative;
  margin: 0;
}

.hero img {
  display: block;
  width: 100%;
}

.hero figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.75rem 1rem;
  color: #fff;
  background: rgb(0 0 0 / 55%);
}

Understand stacking and pointer behavior

An opacity value below 1 creates a new stacking context. That can change how the image participates in z-index ordering compared with neighboring elements. If an image appears behind or in front of an element unexpectedly, inspect the ancestor stacking contexts rather than adding arbitrary, very large z-index values.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Opacity does not disable hit testing. An image at opacity: 0 can still occupy space, receive pointer events, and block clicks on elements behind it. If the invisible image should not intercept input, disable pointer events explicitly:

.is-hidden {
  opacity: 0;
  pointer-events: none;
}

That rule does not remove the element from layout or the accessibility tree. Use display: none or the hidden attribute only when the content should be removed from layout and interaction altogether.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep transparent images accessible

Protect contrast

Reducing opacity on text or text overlays changes the final composited color and can lower contrast. Check the result against its actual background. The contrast targets commonly used for normal text are 4.5:1 and 3:1 for large text; large text is at least 18.66px when bold or 24px when not bold under the cited guidance.

Keep meaningful text at full opacity where possible. If a decorative image is faded, give it an appropriate alt value (or an empty alt when it is purely decorative). Do not rely on a low-contrast image to convey information that has no text equivalent.

Do not use opacity as the only disabled-state signal

A faded control can still be interactive, and an invisible control can still receive focus. Pair visual changes with a real disabled state, such as the disabled attribute on a button, when the control is unavailable.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Useful patterns

Reusable utility classes

.opacity-25 { opacity: 0.25; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

Apply one class per image:

<img class="opacity-50" src="photo.jpg" alt="Product detail">

Reveal an image after an interaction

.reveal {
  opacity: 0;
  transition: opacity 250ms ease;
}

.reveal.is-visible {
  opacity: 1;
}

JavaScript can add or remove is-visible after an explicit action or after an IntersectionObserver detects the image. Keep the class change separate from the CSS so the same visual state can be triggered by a button, keyboard activation, or another non-hover interaction.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a custom property for theming

:root {
  --image-opacity: 0.8;
}

.photo {
  opacity: var(--image-opacity);
}

Changing the custom property lets a theme or component adjust the value without duplicating selectors.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

The image does not change

  • Confirm the stylesheet is loaded and that the selector matches the element.
  • Inspect the image in browser developer tools and check the computed opacity value.
  • Look for a more specific rule or an inline style overriding your class. Fix the selector instead of reaching for !important unless you control the cascade deliberately.

The whole card, including text, is faded

Opacity is inherited as a composited effect from the container. Move the property to the image itself, or replace container opacity with an alpha background color.

The hover fade is not visible

  • Make sure the initial and hover values differ.
  • Check that another element is not covering the image and receiving the pointer.
  • On touch devices, do not depend on hover; provide a tap or focus state.

A transparent image still blocks clicks

That is expected hit-testing behavior. Add pointer-events: none when the invisible layer must let clicks pass through, or remove it from the interface entirely when appropriate.

The image looks washed out over a white page

Transparency reveals whatever is behind the image. Set a deliberate background on the parent or use an opaque replacement color if the design requires consistent appearance.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Performance and rendering considerations

Changing opacity is generally inexpensive, but animated opacity can cause the browser to create a composited layer. Apply will-change: opacity only when profiling shows a real problem; leaving it on many images can consume memory. Keep transitions short, avoid animating dozens of large images simultaneously, and test on mobile hardware.

Opacity does not reduce the file size or network cost of an image. Use appropriately sized files, modern formats, and responsive image markup independently of the visual effect:

<img
  src="photo-800.webp"
  srcset="photo-400.webp 400w, photo-800.webp 800w, photo-1200.webp 1200w"
  sizes="(max-width: 600px) 100vw, 800px"
  alt="A mountain at sunrise"
>

Or skip the browser setup

If your goal is to obtain a clean screenshot of a page containing transparent images, ScreenshotNeo can render the URL through one API request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

cURL

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python

import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const bytes = new Uint8Array(await res.arrayBuffer());
await Bun.write('shot.webp', bytes);

See the ScreenshotNeo documentation for output formats and request options. The service also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets or custom viewports, retina scale, PDF paper settings, custom CSS and JavaScript, click and wait actions, blocked requests, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, caching with a chosen TTL, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Parameter names used by other screenshot APIs also work for easier migration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is included on every plan. Create a free ScreenshotNeo account to get started.

Frequently Asked Questions

Can I use a percentage instead of a decimal for opacity?

Yes. CSS accepts percentages from 0% to 100%; for example, 60% is equivalent to 0.6.

Does opacity make an image file smaller?

No. It changes rendering only. Optimize dimensions, format, and responsive delivery separately.

Why can an opacity-zero image still be clicked?

Opacity affects compositing, not hit testing. Add pointer-events: none or remove the element when it should not receive input.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How do I fade only the image, not its caption?

Apply opacity to the img element and keep the caption outside it, or use an alpha background for the caption container.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.