opacity

How do I get the opacity of an element using Javascript?

爱⌒轻易说出口 提交于 2019-11-27 05:59:08
问题 If I have: #em { opacity:0.5; } How do I get #em 's opacity using javascript ? :D I've got troubles with the following (it returns nothing): return document.getElementById("em").style.opacity; 回答1: Setting a CSS value in a stylesheet is not the same as setting it through the style property. You need to look at the getComputedStyle method to obtain this (and also currentStyle for older IE). 回答2: var em = document.getElementById("em"); var temp = window.getComputedStyle(em).getPropertyValue(

What is the difference between opacity and that through alpha channel (rgba)?

江枫思渺然 提交于 2019-11-27 05:51:51
问题 div { background-color: rgb(255,0,0); opacity: 1; } div { background-color: rgba(255,0,0,1); } What is the difference between the above two? 回答1: Opacity sets the opacity value for an element and all of its children; While RGBA sets the opacity value only for a single declaration. This is well explained here. http://www.css3.info/introduction-opacity-rgba/ 回答2: Opacity : The opacity property sets the opacity level for an element.(Setting opacity for an elements makes the whole element

JPEG image with alpha channel on website [closed]

和自甴很熟 提交于 2019-11-27 05:42:13
问题 I would like to make a JPEG image file with some pixels that are partially transparent or fully transparent, similar to a PNG file with an alpha channel. Is this possible? If so, how would I go about doing this? I would like to use the image on a website. If I try to do this, would it work in any or all of the popular browsers (IE 7+, Firefox, Safari)? Assuming it is possible, will it just work, or are there any tricks or hacks required to make it work? EDIT: Some of the replies say I can't

Can I do knock-out/punch-through transparency with CSS fonts?

核能气质少年 提交于 2019-11-27 04:39:14
问题 I would like to know if there is any way I can apply 100% transparency to text so that we can see the background picture of the page within the characters in the text. i.e. imagine I’ve got a <div> with a white background, and a background image on <body> . I’d like to set the text inside the <div> so that the background image on <body> can be seen through the text, despite the white background on the <div> . I could probably use an inverted font but I would prefer a better way to do it if

Why can't child elements override the opacity of parent with a greater value?

不问归期 提交于 2019-11-27 03:44:01
问题 As we know, child elements cannot as of now override the opacity property of its parent. The opacity property of the parent always takes effect. This makes sense when the child is trying to underride (override with smaller value) the opacity of the parent. But what about if the child is trying to override it with a greater value? Shouldn't that be allowed? Why can't a translucent parent have an opaque child? Can anyone share thoughts on why such a restriction was decided as part of the CSS

HTML/CSS text background transparent but text not

喜夏-厌秋 提交于 2019-11-27 03:27:04
So I am having a problem. I have looked around and looked around but no luck. I would like to make the background of my body transparent but leave the text non transparent. As it is right now I keep making both the same opacity. Here is my code: @charset "utf-8"; body { font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif; background-color: #42413C; margin: 0; padding: 0; color: #000; } /* ~~ Element/tag selectors ~~ */ ul, ol, dl { padding: 0; margin: 0; } h1, h2, h3, h4, h5, h6, p { margin-top: 0; padding-right: 15px; padding-left: 15px; opacity:1; } a img { border: none; } a:link { color:

How to darken a background using CSS?

女生的网名这么多〃 提交于 2019-11-27 02:45:35
I have an element with text in it. Whenever I decrease the opacity, then I decrease the opacity of the WHOLE body. Is there any way I can just make the background-image darker, and not everything else? background-image:url('http://fc02.deviantart.net/fs71/i/2011/274/6/f/ocean__sky__stars__and_you_by_muddymelly-d4bg1ub.png'); shin Just add this code to your image css body{ background: /* top, transparent black, faked with gradient */ linear-gradient( rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7) ), /* bottom, image */ url(http://fc02.deviantart.net/fs71/i/2011/274/6/f/ocean__sky__stars__and_you_by

Java - set opacity in JPanel

十年热恋 提交于 2019-11-27 02:39:11
问题 Let's say I want to make the opacity of a JPanel %20 viewable? I don't mean setOpaque (draw or not draw) or setVisible (show or hide)... I mean make it see-through JPanel.. you know? Is this possible? 回答1: panel.setBackground( new Color(r, g, b, a) ); You should also look at Backgrounds With Transparency to understand any painting problems you might have when you use this. 回答2: Use the alpha attribute for the color. For instance: panel.setBackground(new Color(0,0,0,64)); Will create a black

Any trick to use opacity on a panel in Visual Studio Window Form?

China☆狼群 提交于 2019-11-27 01:38:43
I recently started exploring Visual Studio. I was trying to create a slide menu. More specifically, when the user would press the button a submenu would pop up to the right. To achieve that i have placed a Panel to resize itself. Apart from functionality i wanted to add a bit more design and make the Panel appear a bit faded. I know that Panels in Visual studio do not have opacity, but i was thinking if anyone knows a way-trick-idea about how it can be achieved. I tried a Picture Box but that too didn't have Opacity as a property. I avoided to use the regular Menu object that visual studio

How to apply an opacity without affecting a child element with html/css?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 01:15:46
I want to achieve this using html and css: I have tried to set the opacity of the container to 0.3 and the box to 1, but it doesn't work: both divs have 0.3 opacity. jsFiddle of my try here The effect I am trying to achive is a popup box that comes on top of the page. It is highlighted by fading the content below (by lowering the opacity). Ilia Frenkel As far as I know you can't do it in a simple way. There a couple of options here: Use absolute positioning to position box "inside" the container. #container { opacity: 0.3; background-color: #777788; position: absolute; top: 100px; left: 100px;