I’m trying to get the image inside my login form not blurred but keep the background outside of the login form blurred
What I’m trying to do
Tried backdrop filter and etc
.bg-image {
position: fixed;
display: inline-block;
top: 0;
left: 0;
width: 100%;
height: 100%;
transform: scale(1.1);
background-image: url("https://i.ibb.co/DWvpCWD/login-bg.jpg");
filter: blur(3px);
-webkit-filter: blur(3px);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.bg-text {
background-color: rgba(0, 0, 0, 0.7);
color: white;
font-weight: 500;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 2;
padding: 40px;
display: flex;
justify-content: center;
border-radius: 3px;
width: 90%;
max-width: 300px;
}
<div class="bg-image"></div>
<div class="bg-text">
<div class="row">
<div class="login-register">
<a href="/login" class="active">Login</a>
<a href="/register">Register</a>
</div>
<div>
<form action="post" class="form">
<div class="input-group">
<label for="username">Username</label>
<input type="text" name="username">
</div>
<div class="input-group">
<label for="password">Password</label>
<input type="password" name="password">
</div>
<div class="checkbox">
<input class="checkbox-effect checkbox-effect-1" id="get-up-1" type="checkbox" name="remember">
<label for="get-up-1">Remember Me</label>
</div>
<button type="submit">Login</button>
<a class="forgot-password" href="">Forgot Password?</a>
</form>
</div>
</div>
</div>
Trying to get the image that’s behind the .bg-text container to not be blurred
2
Answers
One hack is using the same image as a bg-image for
div.bg-text
element (as @Ali Sheikhpour also suggested).Based on the image you provided, background-size of 1780px seems just right.
Check out below, edited, snippet.
But it is not a best solution. On the codepen 1780px seems the right bg-size while on the stackoverflow
run code snippet
>full page
1990px
seems the right bg-size. You should test it out on various screen sizes,and if you make the main background responsive, you should do the same with text-bg element’s bg-image size.
Have two background elements layered on top of one another. The one at the back is not blurred. The one on top is blurred, but has the central area masked with a pair of linear gradients, so the unblurred background beneath shows through.
After running this snippet, use the full page link for best results.