Vuetify.js - Adding blur and transparent styles to v-card [duplicate] - html

This question already has answers here:
How to apply a CSS filter to a background image
(22 answers)
Closed 2 years ago.
.content {
float: left;
width: 100%;
background-image: url('images/zwemmen.png');
height: 501px;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
}
.opacity {
background-color: rgba(5, 98, 127, 0.9);
height: 100%;
overflow: hidden;
}
.info {
float: left;
margin: 100px 0px 0px 30px;
width: 410px;
}
<div class="content">
<div class="opacity">
<div class="image">
<img src="images/zwemmen.png" alt="" />
</div>
<div class="info">
a div wih all sort of information
</div>
</div>
</div>
If I do not want to blur the button, what do I need to do?

When using the blur or opacity property, it is not possible to ignore the child element. If you apply either of those properties to parent element, it will automatically apply to child elements too.
There is an alternate solution: create two elements inside your parent div – one div for the background and another div for the contents. Set position:relative on the parent div and set position:absolute; top:0px; right:0px; bottom:0px; left:0px; (or set height/width to 100%) to the child element for the background. Using this method, the content div will not be affected by properties on the background.
Example:
#parent_div {
position: relative;
height: 100px;
width: 100px;
}
#background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: red;
filter: blur(3px);
z-index: -1;
}
<div id="parent_div">
<div id="background"></div>
<div id="textarea">My Text</div>
</div>
If you see the background masking over the content, then use the z-index property to send the background behind the second content div.

How to disable blur on child element?
.enableBlur>* {
filter: blur(1.2px);
}
.disableBlur {
filter: blur(0);
}
<div class="enableBlur">
<hr>
qqqqq<br>
<span>qqqqq</span><br>
<hr class="disableBlur">
<div>aaaaa</div>
<div>bbbbb</div>
<div class="disableBlur">DDDDD</div>
<hr>
<img src="https://lh5.googleusercontent.com/-n8FG4f09-ug/AAAAAAAAAAI/AAAAAAAACmA/ldtxmWX1SyY/photo.jpg?sz=48">
<img class="disableBlur" src="https://lh5.googleusercontent.com/-n8FG4f09-ug/AAAAAAAAAAI/AAAAAAAACmA/ldtxmWX1SyY/photo.jpg?sz=48">
</div>

My solution seems a bit simpler but may have some compatibility issues. I just used backdrop-filter with the blur filter.
backdrop-filter: blur(2px);

Just create two divisions and adjust their z-indexes and margins such that the division you want to blur lies below the division you want to appear on top.
PS: Don't create division inside a division cause the child inherits the parent's properties.
#forblur {
height: 200px;
width: 200px;
background-color: blue;
margin: auto;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px) -ms-filter: blur(3px);
filter: blur(3px);
z-index: -1;
}
#on-top-container {
margin: auto;
margin-top: -200px;
text-align: center;
height: 200px;
width: 200px;
z-index: 10;
}
<div id="forblur">
</div>
<div id="on-top-container">
<p>TEXT</p>
</div>

Related

Problem with css scale transform and filter blur

I have problem on Chrome browser while combining two properties: filter: blur(15px) and transform: scale3d(1.2,1.2,1).
I have two images, one over another. Image on higer layer is blurred, but it's edges got transparent when I applied that filter, so I added overflow:hidden to parent div, and scaled up image. I expected to see just opaque part of image.
It works as expected on Firefox and Opera, however on Chrome and MS Edge browsers not. How to fix this?
#images-box{
position: relative;
width: 500px;
height: 280px;
overflow:hidden;
}
.image{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('https://images.unsplash.com/photo-1558389157-a986a38f3431?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1950&q=80');
background-size: cover;
background-position: 50% 50%;
}
.image.blured{
-webkit-filter: blur(14px);
filter: blur(14px);
z-index: 2;
-webkit-transform: scale3d(1.2,1.2,1);
transform: scale3d(1.2,1.2,1);
}
<div id="images-box">
<div class="image"></div>
<div class="image blured"></div>
</div>
Changing scale3d(1.2,1.2,1) to scale(1.2) helped me on Chrome 86.0.4240.198.

Using Images in the Header with "blur"

I'm trying to make my background image blurred.. to then have text, buttons on top of it.. but blur is also blurring the text and buttons and I'm not sure how to separate the two.
header {
background: url("street-238458.jpg") no-repeat center;
-webkit-filter: blur(5px); /* Safari 6.0 - 9.0 */
filter: blur(5px);
background-size: 100% 100%;
height: 630px;
}
<header>
<div class="container-fluid">
<div class="text-center">
<h1 class="heading">My h1 is here... blah blah</h1>
<p>We help people out, every day.</p>
<button class="btn btn-lg btn-danger heading" href="#">This is the button</button>
</div>
</div>
</header>
You can have 2 different containers for your header, so you can style the background container without affecting the content. Check out the reference in the comments.
This pen should be what your looking for. Credit to respective owner.
The trick is to have two separate containers, the outer container should have background image.
.content:before {
content: "";
position: fixed;
left: 0;
right: 0;
z-index: -1;
display: block;
background-image: url('http://666a658c624a3c03a6b2-25cda059d975d2f318c03e90bcf17c40.r92.cf1.rackcdn.com/unsplash_527bf56961712_1.JPG');
width: 1200px;
height: 800px;
-webkit-filter: blur(5px);
-moz-filter: blur(5px);
-o-filter: blur(5px);
-ms-filter: blur(5px);
filter: blur(5px);
}

color image inside grayscale(100%) container

I have a div with a background-image and i'm using a filter to display it in black and white (filter: grayscale(100%);). I'm now trying to place a color icon inside that div. Tried to set the icon to grayscale(0%), but this does not appear to work.
Here is an example:
#a1, #a2 {
background-image: url(http://ndrichardson.com/blog/wp-content/uploads/2012/04/colorpsychology.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
}
#a1 {
height: 250px;
width: 250px;
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
position: relative;
}
#a2 {
height: 50px;
width: 50px;
-webkit-filter: grayscale(0%);
filter: grayscale(0%);
position: absolute;
top: 0px;
right: 0px;
}
<div id="a1"><!-- << this should be black and white -->
<div id="a2"><!-- << this should be color -->
</div>
</div>
Is there a way to do this without creating an additional div to hold the background image? The real code is much more complex, that's why I would like to avoid the extra div(s), if possible.
Yes of course, you should use ::before and ::after pseudo-elements:
#a1 {
height: 250px;
width: 250px;
position: relative;
}
#a1:after, #a1:before {
content: '';
background-image: url(http://ndrichardson.com/blog/wp-content/uploads/2012/04/colorpsychology.jpg);
background-repeat: no-repeat;
background-size: 100% 100%;
position: absolute;
}
#a1:before {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
width: 100%;
height: 100%;
}
#a1:after {
height: 50px;
width: 50px;
top: 0px;
right: 0px;
}
<div id="a1"></div>
DEMO on JSFiddle
It's not possible to have color inside a container with filter: grayscale(100%).
See the the filter property in the spec (emphasis mine):
A computed value of other than none results in the creation of a
stacking context the same way that CSS opacity does. All
the elements descendants are rendered together as a group with the
filter effect applied to the group as a whole.
So yes, you will have to separate the contents with the filter from the contents without it.
This doesn't necessarily mean you need additional wrappers in your HTML, as Hiszpan proposes you can also use pseudo-elements.

Translucent effect to section of webpage [duplicate]

This question already has answers here:
Opacity of background-color, but not the text [duplicate]
(5 answers)
Closed 7 years ago.
I have a background image for my webpage and I have this
HTML:
<body>
<div class="front">
<p>Hello World</p>
</div>
</body>
CSS:
.front{
background-color:silver;
height:200px;
width:200px;
}
The width & height of div is 200px,200px.I want the area covered by the div element to be translucent ie. showing the blur background, but the text that div contains should be clear as well. How do I do that?
You need a rgba background:
background-color: rgba(192,192,192,0.5);
Colors can be defined in the Red-green-blue-alpha model (RGBa) using
the rgba() functional notation. RGBa extends the RGB color model to
include the alpha channel, allowing specification of the opacity of a
color. a means opacity: 0=transparent; 1=opaque;
You could simply add opacity: 0.5; to your css class.
You can use the rgba for the background image since adding opacity would apply it for the text in the div also.
background-color: rgba(192,192,192,0.5);
but this is not supported in IE.
So you can have a transparent background image created and applied using background-image property.
you can use opacity for the background-image and use before Selector to remain the opacity of the text:
like this:
.front {
z-index: 1;
}
.front:before {
content: "";
position: absolute;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
right: 0;
background-image: url("http://webneel.com/wallpaper/sites/default/files/images/01-2014/23-animation-wallpaper.preview.jpg");
background-repeat: no-repeat;
background-size: 100%;
opacity: 0.4;
filter: alpha(opacity=40);
height: 200px;
width: 200px;
}
.font > p {
z-index: -1;
opacity: 1;
filter: alpha(opacity=100);
}
<div class="front">
<p>Hello World</p>
</div>
JSFIDDLE DEMO
try this css :
.front{
background-color:silver;
height:200px;
width:200px;
opacity: 0.4;
}
Increase or decrease opacity according to your choice.
Using opacity in CSS is the easiest way.
Well, little out of the box, you can really blur your image if you try a little different mark-up.
Here it goes
.front{
background-color:silver;
height:200px;
width:200px;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
z-index:0;
}
.back{
position: absolute;
top: 0;
}
<body>
<div class="front"></div>
<div class="back">
<p>Hello World</p>
</div>
</body>

How to blur(css) div without blur child element [duplicate]

This question already has answers here:
How to apply a CSS filter to a background image
(22 answers)
Closed 2 years ago.
.content {
float: left;
width: 100%;
background-image: url('images/zwemmen.png');
height: 501px;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px);
-ms-filter: blur(3px);
filter: blur(3px);
}
.opacity {
background-color: rgba(5, 98, 127, 0.9);
height: 100%;
overflow: hidden;
}
.info {
float: left;
margin: 100px 0px 0px 30px;
width: 410px;
}
<div class="content">
<div class="opacity">
<div class="image">
<img src="images/zwemmen.png" alt="" />
</div>
<div class="info">
a div wih all sort of information
</div>
</div>
</div>
If I do not want to blur the button, what do I need to do?
When using the blur or opacity property, it is not possible to ignore the child element. If you apply either of those properties to parent element, it will automatically apply to child elements too.
There is an alternate solution: create two elements inside your parent div – one div for the background and another div for the contents. Set position:relative on the parent div and set position:absolute; top:0px; right:0px; bottom:0px; left:0px; (or set height/width to 100%) to the child element for the background. Using this method, the content div will not be affected by properties on the background.
Example:
#parent_div {
position: relative;
height: 100px;
width: 100px;
}
#background {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: red;
filter: blur(3px);
z-index: -1;
}
<div id="parent_div">
<div id="background"></div>
<div id="textarea">My Text</div>
</div>
If you see the background masking over the content, then use the z-index property to send the background behind the second content div.
How to disable blur on child element?
.enableBlur>* {
filter: blur(1.2px);
}
.disableBlur {
filter: blur(0);
}
<div class="enableBlur">
<hr>
qqqqq<br>
<span>qqqqq</span><br>
<hr class="disableBlur">
<div>aaaaa</div>
<div>bbbbb</div>
<div class="disableBlur">DDDDD</div>
<hr>
<img src="https://lh5.googleusercontent.com/-n8FG4f09-ug/AAAAAAAAAAI/AAAAAAAACmA/ldtxmWX1SyY/photo.jpg?sz=48">
<img class="disableBlur" src="https://lh5.googleusercontent.com/-n8FG4f09-ug/AAAAAAAAAAI/AAAAAAAACmA/ldtxmWX1SyY/photo.jpg?sz=48">
</div>
My solution seems a bit simpler but may have some compatibility issues. I just used backdrop-filter with the blur filter.
backdrop-filter: blur(2px);
Just create two divisions and adjust their z-indexes and margins such that the division you want to blur lies below the division you want to appear on top.
PS: Don't create division inside a division cause the child inherits the parent's properties.
#forblur {
height: 200px;
width: 200px;
background-color: blue;
margin: auto;
-webkit-filter: blur(3px);
-moz-filter: blur(3px);
-o-filter: blur(3px) -ms-filter: blur(3px);
filter: blur(3px);
z-index: -1;
}
#on-top-container {
margin: auto;
margin-top: -200px;
text-align: center;
height: 200px;
width: 200px;
z-index: 10;
}
<div id="forblur">
</div>
<div id="on-top-container">
<p>TEXT</p>
</div>