Comments on: opacity https://css-tricks.com Tips, Tricks, and Techniques on using Cascading Style Sheets. Sun, 14 Aug 2022 10:06:26 +0000 hourly 1 https://wordpress.org/?v=6.1.1 By: oceangermanique https://css-tricks.com/almanac/properties/o/opacity/#comment-1796707 Sun, 14 Aug 2022 10:06:26 +0000 http://css-tricks.com/?page_id=14083#comment-1796707 In reply to oceangermanique.

I was mistaken :
<<…in the property definition of ‘transparency’, there is …>>
it is of course “opacity”

]]>
By: oceangermanique https://css-tricks.com/almanac/properties/o/opacity/#comment-1796706 Sun, 14 Aug 2022 10:04:02 +0000 http://css-tricks.com/?page_id=14083#comment-1796706 on this site https://www.w3.org/TR/css-color-3/#transparency , in the property definition of ‘transparency’, there is the following text:

” If the object has children, then the effect is as if the children
were blended against the current background using a mask where the
value of each pixel of the mask is ”

But what exactly does it mean ? thanks !

]]>
By: gowhtam https://css-tricks.com/almanac/properties/o/opacity/#comment-1771459 Sat, 01 May 2021 23:53:54 +0000 http://css-tricks.com/?page_id=14083#comment-1771459 how to make a strong text over a transparent div. i don’t want to use rgba. i want to achieve it using opacity. tell me a way

]]>
By: Florian Limpöck https://css-tricks.com/almanac/properties/o/opacity/#comment-1755986 Wed, 22 Apr 2020 11:30:56 +0000 http://css-tricks.com/?page_id=14083#comment-1755986 visibility: hidden is not the same like opacity: 0

example use both on a button, and with opacity: 0 you can still click the button but with visibility: hidden you cant.

]]>
By: May https://css-tricks.com/almanac/properties/o/opacity/#comment-1752747 Mon, 25 Nov 2019 21:00:48 +0000 http://css-tricks.com/?page_id=14083#comment-1752747 I need to overwrite a background-color which they already use !Important. so I am thinking to put the background opacity to 0. I can’t use RGBA(0,0,0,0). Is there any other way to do it in CSS?

]]>
By: Geoff Graham https://css-tricks.com/almanac/properties/o/opacity/#comment-1666928 Thu, 21 Feb 2019 22:12:25 +0000 http://css-tricks.com/?page_id=14083#comment-1666928 In reply to Colin.

Hey Colin! Yeah, that’s an unfortunate side effect of using opacity on an element that has other elements inside of it: everything becomes opaque.

You might try separating the background image into its own element outside of the other elements and try using absolute positioning to line it up with everything else. That way, it will be isolated so the opacity affects it alone.

]]>
By: Colin https://css-tricks.com/almanac/properties/o/opacity/#comment-1666260 Wed, 20 Feb 2019 01:40:21 +0000 http://css-tricks.com/?page_id=14083#comment-1666260 Hi,
I have a page with a background image and a lot of CSS elements that themselves have colour backgrounds.
I’ve added
body {
opacity: 0.6;

Which is ideal for the transparency of the elements, but all the text is also transparent too.
can you point me in the right direction. Still working on the CSS learning curve.

]]>
By: Dennis Ferreira https://css-tricks.com/almanac/properties/o/opacity/#comment-1615734 Tue, 06 Feb 2018 06:52:55 +0000 http://css-tricks.com/?page_id=14083#comment-1615734 In reply to Ck Maurya.

Has anyone noticed this new thing where if you define a background color like this; background-color: #000000b3; it adds opacity to it. This seems fairly new to me been trying to find documentation on it all morning. If anyone has more info, let me know (Only tried it in Firefox, no idea if it works in other browsers)

]]>
By: G Hart https://css-tricks.com/almanac/properties/o/opacity/#comment-1612919 Wed, 08 Nov 2017 15:30:07 +0000 http://css-tricks.com/?page_id=14083#comment-1612919 In reply to Hassan.

Gilbrizzle’s info is good as it relates to the topic of this article, which is the “opacity” attribute, but what Hassan is asking requires a simpler solution: don’t use “opacity”, but rather use RGB + “alpha” instead.

“opacity” attribute will apply to all of the attributes of the selector where it’s defined.

RGBA, however, only applies to the specific attribute it’s applied to and leaves the other attributes of the selector alone.

For example:

article {
  color: #000000; background: 
  rgba(180, 180, 180, 0.4);
}

Doing this gives a 40% level of transparency to the grey background, but the text in front of it remains black.

There are reasons to use either solution, so it’s a matter of which is best for what you’re trying to do. I think this simpler one may be you were looking for though.

]]>
By: G Hart https://css-tricks.com/almanac/properties/o/opacity/#comment-1612916 Wed, 08 Nov 2017 14:36:43 +0000 http://css-tricks.com/?page_id=14083#comment-1612916 In reply to Andrew.

Hey Andrew,

You need to create a class and call it in only on those images you wish to have the transparency.

CSS:

.transimage img{ [properties] }
.transimage img:hover{ [properties] }

HTML:

div class="transimage"
img src="" /
/div
]]>
By: Andrew https://css-tricks.com/almanac/properties/o/opacity/#comment-1610913 Fri, 04 Aug 2017 23:18:06 +0000 http://css-tricks.com/?page_id=14083#comment-1610913 I have a problem that I cannot seem to get my head around, …. I am new to CSS and I am trying to implement opacity to deveral images on the page. Using this code:

img {
    opacity: 0.5;
    filter: alpha(opacity=50); /* For IE8 and earlier */
}

img:hover {
    opacity: 1.0;
    filter: alpha(opacity=100); /* For IE8 and earlier */
}

I can make my images opaque until I hover over them, …. but, how do I apply this only to specific images on the page?

]]>
By: Gilbrizzle https://css-tricks.com/almanac/properties/o/opacity/#comment-1607831 Wed, 05 Apr 2017 21:40:11 +0000 http://css-tricks.com/?page_id=14083#comment-1607831 In reply to damien eichhorn.

@damien, wrap the box in a container with position:relative on it, put opacity on the child box, put your text element as a sibling to the box with opacity and use position:absolute to place it over its sibling.

]]>
By: Gilbrizzle https://css-tricks.com/almanac/properties/o/opacity/#comment-1607830 Wed, 05 Apr 2017 21:37:22 +0000 http://css-tricks.com/?page_id=14083#comment-1607830 In reply to Hassan.

Hassan, it sounds like you’re asking how to have opacity on a box while having text show inside the box that does not have opacity on it.

The opacity property will affect anything inside of it. So the technique I prefer is to:
1) wrap the box (that needs opacity) within a container and give it position:relative
2) give the box its opacity property (obviously)
3) put the text in its own container as an adjacent sibling to the opaque box, give it position:absolute, set the top & left properties however you want to set its placement

]]>
By: Varun Puravankara https://css-tricks.com/almanac/properties/o/opacity/#comment-1607442 Tue, 14 Mar 2017 06:20:11 +0000 http://css-tricks.com/?page_id=14083#comment-1607442 How to change background image’s opacity?

]]>
By: Mr.frog https://css-tricks.com/almanac/properties/o/opacity/#comment-1603758 Sun, 28 Aug 2016 12:42:34 +0000 http://css-tricks.com/?page_id=14083#comment-1603758 In reply to UAkiev.

Earch

]]>