opacity

Background images: how to fill whole div if image is small and vice versa

╄→尐↘猪︶ㄣ 提交于 2019-11-27 18:04:53
I have three problems: When I tried to use a background image in a smaller size div, the div shows only part of image. How can I show the full or a specific part of image? I have a smaller image and I want to use in a bigger div. But don't want to use repeat function. Is there any way in CSS to manipulate the opacity of an image? yossi Resize the image to fit the div size. With CSS3 you can do this: /* with CSS 3 */ #yourdiv { background: url('bgimage.jpg') no-repeat; background-size: 100%; } How Do you Stretch a Background Image in a Web Page : About opacity #yourdiv { opacity: 0.4; filter:

Is there a way to make IE8 honour opacity on an `:before` pseudo element?

戏子无情 提交于 2019-11-27 17:47:31
问题 I have this simple CSS... div:before { content: "G'day"; filter: alpha(opacity=40); -moz-opacity: .4; opacity: .4; } jsFiddle. The :before pseudo element has the correct opacity in Firefox 6. In IE8, the opacity is not applied. Typically, setting the opacity on the div works, but that isn't what I want. I tried adding display: block but it didn't help. Whilst I could workaround this, is there any trick to get IE8 to honour the opacity property on a :before (and :after for that matter) pseudo

transparency and text problem

佐手、 提交于 2019-11-27 16:24:22
I'm playing with the opacity CSS attribute. It works nicely for the box (with at 50% or black at 30%) - the problem is that the text inside the box is also transparent. I would like the text to be 100% white in a box with at 30% transparency. The solution is to use CSS with tweaks or to use a .png for the background and to forget the opacity setting. Tell me, how to do 30% opacity with 100% opacity text inside. Thanks in advance Your choices are: Using CSS3 : background: rgba(255, 255, 255, 0.3) . Live Demo Absolutely position two <div> tags on top of each other. One of them is the background,

Setting opacity of html elements in different browsers

老子叫甜甜 提交于 2019-11-27 16:09:12
问题 I need to set an HTML <img src=""/> object's opacity in JavaScript in all the browsers. In Firefox I do it with line: imageobject.style.MozOpacity=opacity/100; What is the proper javascript code to set the opacity of an element in different browsers? 回答1: img.style.opacity = .5; //For real browsers; img.style.filter = "alpha(opacity=50)"; //For IE; You don't need to sniff the user agent, just set both values as browsers will ignore the irrelevant one. 回答2: Set the Opacity of an element in

How can I make my website's background transparent without making the content (images & text) transparent too?

妖精的绣舞 提交于 2019-11-27 15:43:25
问题 I'm doing a website for a school project, and I'm currently having a small problem... I can't make the body's background transparent without it also affecting the content in it. Here's my HTML code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <title>text</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="head"> </div> <div id="wrapper"> <ul id=

How to keep text opacity 100 when its parent container is having opacity of 50

随声附和 提交于 2019-11-27 12:51:00
问题 I have a list div which have a opacity set to 50 and inside this div I want to display some text with opacity 100, Here's what I mean: <div id="outer"> <div id="inner"> Text </div> </div> The CSS would be: #outer { opacity: 0.5; } #inner { opacity: 1.0; } I tried that, but it doesn't work. please help Regards 回答1: A simple and compatible solution is to remove all your opacity , and use: #outer { background: url(50%-transparent-white.png); background: rgba(255,255,255,0.5) } Browsers that

how to handle 'double opacity' of two overlapping divs

…衆ロ難τιáo~ 提交于 2019-11-27 12:04:23
I have two divs, both with 0.6 opacity. I need them to overlap but retain their opacity and not create a new combined opacity level. I can't use an image. EDIT -- The little circle is supposed to have a canvas element in it. Not sure if pseudo-elements would be the best solution. Is there anyway to do this with CSS, or should I just use canvas? example - http://dabblet.com/gist/1566209 HTML: <div id="foo"> <div id="bar"> </div> </div> CSS: /** * Double Opacity */ body{background:green;} #foo{ height:150px; width:250px; background:rgba(0, 0, 0, 0.6); position:absolute; left:40%; top:20%; } #bar

CSS Opacity inheritance issue [duplicate]

老子叫甜甜 提交于 2019-11-27 07:59:53
问题 Possible Duplicate: CSS Opacity Property I'm making a layer on an image which has a transparency and I got a problem there. When I wrote down any texts on the layer, they also get the same transparency. I thought it's because of the inheritance problem and added 'position:relative' to reset my child div, though, it didn't work at all. I just want to reset the opacity of the child div(#TXT below). Here's my code. <!DOCTYPE html> <html> <header> <meta charset="UTF-8"> <style type="text/css"> *

Div opacity based on scrollbar position

荒凉一梦 提交于 2019-11-27 07:54:04
Find an example of how to fade out a div when the scroll bar reaches a certain position here . But it's not a smooth throttle-type fade. Here is the code from that jsfiddle: var divs = $('.social, .title'); $(window).scroll(function(){ if($(window).scrollTop()<10){ divs.fadeIn("fast"); } else { divs.fadeOut("fast"); } });​ I want the opacity percentage to to reflect the position of the scrollbar. For instance when the scroll bar is at very top position, the div opacity is 100%. When I scroll down 35px I want the opacity of the div to fade down to 0% Perhaps a technique could be when div A is

R Scatter Plot: symbol color represents number of overlapping points

≯℡__Kan透↙ 提交于 2019-11-27 06:55:57
Scatter plots can be hard to interpret when many points overlap, as such overlapping obscures the density of data in a particular region. One solution is to use semi-transparent colors for the plotted points, so that opaque region indicates that many observations are present in those coordinates. Below is an example of my black and white solution in R: MyGray <- rgb(t(col2rgb("black")), alpha=50, maxColorValue=255) x1 <- rnorm(n=1E3, sd=2) x2 <- x1*1.2 + rnorm(n=1E3, sd=2) dev.new(width=3.5, height=5) par(mfrow=c(2,1), mar=c(2.5,2.5,0.5,0.5), ps=10, cex=1.15) plot(x1, x2, ylab="", xlab="", pch