How to avoid inheriting opacity property in CSS?
Tags: css,opacity
Problem :
I have a div
element to which I set opacity: 0.7;
in the CSS file because I would like the text inside it to be opaque. I display some images inside this div
, but the images appear with the inherited opacity property. The result are opaque images.
Is it possible to give a CSS property to the images not to inherit the opacity of the div
that contains them? If not, how can I avoid having the images opaque?
Thanks.
Solution :
If you're using opacity
to allow the text to have partial transparency, then simply set the color
of the element:
#elemId {
color: rgba(0,0,0,0.7);
}
This lets you avoid adjusting the opacity
property, and should work in all browsers that support the opacity
property, too.
CSS Howto..
Set the width of your navbar to 100% Add float:left onto the navbar links body { margin: 0; height: 100%; } #container { width: 100%; height: auto; background-color: gray; }...
Create a div container with position:relative and put your 3 canvases inside with position:absolute and use left to move the canvases as desired. var canvasB=document.getElementById("canvasBottom"); var ctxB=canvasB.getContext("2d"); var canvasL=document.getElementById("canvasLeft"); var...
I think you can try to do it with CSS3 @keyframes rule by using some image of huge hand with a duster moving from one side to another and erasing...
If you look on google fonts I'm sure you will find something similar. Here is an example of using Google web fonts with a font called "Cookie" and it is...
Add table { border-collapse: collapse; }. From the CSS2 specification: In [the border-collapse: separate model], each cell has an individual border. [...] Rows, columns, row groups, and column groups cannot...
You can do it by adding text-align:center; and also position: fixed; to your :after pseudo element. #frame { position: fixed; top:50%; left:50%; transform:translate(-50%,-50%); background-color: black; &:after { position:fixed; content: 'Caption...
I needed to set the background-size. This snippet did the trick: background-size: 100% 100%; Part of the "stricter rendering model" was deferring sizing information to the page, rather than intrinsically...
If you are referring to the jagged edge/mini triangles, then for a simpler time you would be better recreating it the way they have using a repeating http://thegregthompson.com/wp-content/themes/GregThompson/assets/img/border-top.png. I'm sure...
Try this maybe? Make sure JQuery is included at top of page (I host mine myself but you can probably get the google hosting) It looks something like this: <script...
I've used the technique you've described many times and always felt a little guilty. But I continually find that the easiest and most reliable way is to wrap my embeds...
This is not possible using float, but you can try to use a javascript masonry plugin like: http://masonry.desandro.com/ or http://isotope.metafizzy.co/ hope that helps!...
I put this together. Here's the CSS: #cont { margin:5px; overflow:hidden; border:1px solid green; clear:both; } #rel { height:150px; position:relative; display:inline-block; width:50px; } #abs { position:absolute; bottom:0; } #red {...
The document.getElementById() is probably running before that node actually exists. Don't set styles that way as a rule. Use Cascading Style Sheets (CSS). The style can be preloaded and waiting...
first take the style="width: 50%; float:left;" element out and add this to your css file: .blogpage_search { width: 50%; float: left; margin-top: 7px; } @media screen and (max-width: 600px) {...
If I understood correctly you are trying to create COLOR classes .orange { background-color:#f37028; } .silver { background-color:#ccc; } and so on... <ul class="icon-text"> <li class="silver">...</li> <li class="orange">...</li> </ul> also...
Check if $_SESSION[ 'auser'] is set, if it is, make a body with a white background-color. Otherwise make a body with a black background-color. Like this: <?php session_start(); ?> <html...
div { text-align: center; } Demo here: http://jsfiddle.net/Wc8kz/ And only one suggestion: img is self-closing tag and should be defined as <img src="..." /> or even <img src="..."> in HTML5....
I'm not 100% certain that i have the effect you are after, but if not I think you should be able to modify this code to get the result you...
$_SERVER['REQUEST_URI'] will never contain the portion after the hash. It will only show up to about.php and any URL arguments passed with the ?. You should create specific pages for...
you can use position:absolute in your SVG and some text-indent in your #itemCountForCart .buttonCart { padding: 2px 40px; border-radius: 6px; border: none; display: inline-block; color: #fff; text-decoration: none; background-color: #28a8e0;...
Short Answer I had a quick look on the w3schools css selector reference and noted the element+element selector with example: div+p -> Selects all <p> elements that are placed immediately...
No t exactly like it but try this .rainbow{ width:200px; height:20px; background: -webkit-linear-gradient(left, red,orange,yellow,green,blue,indigo,violet); background: -moz-linear-gradient(left, red,orange,yellow,green,blue,indigo,violet,red); background: -o-linear-gradient(left,...
You can use the ::after selector to add content after all h1 elements CSS h1:after { content: url("imagesource.jpg"); display: block; } See this live example However, the site in question...
Actually there is no function text() in cssSelector. So using cssSelector you can't locate element with the text because there is no way to locate with inner text. You should...
$("td.time") select all table cells with class time not only those in that row. Add a reference to the row as the (second) context parameter just as you are doing...
here's my jsFiddle modify your jQuery: $(function() { var container = $('.navbar'); $('.navbar ul li a').click(function(){ $('.navbar > li:first-child > a').text($(this).text()); $('.navbar > li > ul').addClass('hidden'); $('.navbar li ul').slideToggle(100); });...
You should wrap the "table-cell" inside a table. So in this case you add the following to the row class .row{ display:table; width:100%; } ...
There are a couple of options: Transform the CSS files at build time and serve them as static files Make the CSS files dynamic and let ASP.NET populate the paths...
A few bits (further to my initial comment). For generating, I'd drop the extra createElement("span") at the top, since it never gets used. Then create span's in the loop, rather...
Let's imagine your jdk 8 home bin directory is on your shell path. Create Love.java: import javafx.stage.*; import javafx.application.*; import javafx.scene.control.*; import javafx.scene.*; public class Love extends Application { public...