What is the best way to blur the background image without impacting the content displayed on top?

Is there a way to blur the background image without affecting the content above it? I'm having trouble achieving this as blurring the parent element also blurs the content. Any suggestions on how to fix this issue? I've tried a few steps but none of them seem to work.

Solution Snippet

#clan-profile {
  background-image: url(http://placekitten.com/500/200);
  height: 300px;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  -webkit-filter: blur(5px);
  /* Safari 6.0 - 9.0 */
  filter: blur(5px);
}
<section id="clan-profile">
  <div class="container">
    <div class="row pt-4 pb-4">
      <div class="col-12 col-md-6">
        <div class="row pb-1">
          <div class="col-12">
            <h2>Lorem Ipsum</h2>
            <h5>Lorem Ipsum</h5>
          </div>
        </div>

        <div class="row pt-1 pb-1">
          <div class="col-12">
            <img src="https://via.placeholder.com/50x50" alt="" class="img-fluid rounded-circle">
            <img src="https://via.placeholder.com/50x50" alt="" class="img-fluid rounded-circle">
            <img src="https://via.placeholder.com/50x50" alt="" class="img-fluid rounded-circle">
          </div>
        </div>

        <div class="row pt-1 pb-1">
          <div class="col-12">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugit, nulla, sed. Sunt, quo reprehenderit cum ut nihil dolor saepe. Culpa at velit, possimus iste eum ipsum similique sapiente neque aliquam.
          </div>
        </div>
      </div>

      <div class="col-12 col-md-6 pt-3">
        <img src="https://via.placeholder.com/500x200" alt="clan-img" class="img-fluid">
      </div>
    </div>
  </div>
</section>

Answer №1

If it's possible, I recommend separating the parent element clan-profile and the background image.

You could structure it like this:

<section id="clan-profile">
  <div class="clan-image"></div>
  <div class="container">
    <div class="row pt-4 pb-4">
      <div class="col-12 col-md-6">
        <div class="row pb-1">
          <div class="col-12">
            <h2>Lorem Ipsum</h2>
            <h5>Lorem Ipsum</h5>
          </div>
        </div>
...

After that, you can apply the following CSS:

.clan-image {
  background-image: url("...");

  /* Apply a blur effect */
  filter: blur(5px);
  -webkit-filter: blur(5px);
}

Now, you have a choice to make. You can either absolutely position the image, or you can absolutely position the content. Alternatively, you could utilize CSS Grid to position the elements on top of each other, as grid allows for this functionality.

Edit: Check out this Example: https://jsfiddle.net/dw2Lq0zj/

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to navigate by percentage in react

I'm working on a flexbox that scrolls horizontally with boxes set to 25% width. Currently, I have it scrolling by 420px which is causing responsive issues. Is there a way to implement the scroll using percentages instead of fixed pixel values in React ...

Leveraging the power of SCSS @extend within the <style> tag while importing global SCSS

After setting up my project using vue-cli, I incorporated both Bootstrap and Bootstrap-vue into it. To ensure that my theme.scss file is loaded correctly, I created a vue.config.js file and used the prependData option in the following manner: module.expor ...

Create original identifiers for dynamically generated material

I have developed a custom invoice tool that has the capability to dynamically add rows. Here is the code snippet responsible for generating new rows: $("#addrow").click(function(){ $(".item-row:last").after('<tr class="item-row"><td> ...

What is the functionality behind a free hosting website?

Is anyone familiar with websites like Hostinghood, where users can create a subdomain and upload HTML, CSS, etc.? I'm curious about how they operate and how I can create a similar site. This is my first question here, so please respond instead of disl ...

Tips for establishing a fixed point at which divs cease to shrink as the browser size decreases

There are numerous dynamically designed websites where divs or images shrink as the browser size decreases. A great example of this is http://en.wikipedia.org/wiki/Main_Page The div containing the text shrinks proportionally to the browser size until it ...

Utilize CSS to style Hover effects

Can someone please assist me with this issue? I am having trouble getting the CSS to work for my hover effect. I suspect that there might be a problem with my syntax. Here is the HTML code: <div id="horizontalmenu"> <ul> <li><a h ...

Placing a box in the center of its parent container using CSS positioning

Check out this code snippet : HTML <div class="app-cont"> <div class="app-head"> Additional Comments : </div> <div class="app-main"> balallalalalallalalalala <br/> jaslnflkasnlsnlk ...

Adjusting value of one input field according to the content of another text field in an

Just starting out with Angular and I am looking to dynamically change the value of a hidden input field called 'cc_card' based on the first digit entered in another input field called 'cc_number'. For example, if the user enters 5 in &a ...

Why does one image render while the other with the same src does not?

Has anyone encountered a situation where there are 2 img tags with the same src, "images/export.png", but one displays correctly while the other doesn't? Any insights on how this discrepancy can occur? https://i.sstatic.net/z6rnW.png Here's som ...

Unresponsive CSS styles on a specific DIV element

Here is the HTML code I am currently working with: <body> <section id="info"> <div class="status"> ... I have been attempting to apply styles to the div with a class of 'status' using my CSS file linke ...

Various JSON Tag values occurring more than once

Upon receiving a JSON Object in HTML, I am passing it to a JavaScript function defined below. The issue arises when the same folderName appears repeatedly on the HTML page. JSON Object: { "folderName": "arjunram-test", "objects": [ { ...

Is it recommended to place JavaScript/CSS at the bottom of an HTML document?

I am currently utilizing jQuery Mobile, and at the moment, my <head> section looks like this: <head> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1"> <title>help</title> <link ...

Reading settings from web.config file in an HTML page

Currently working with ASP.NET 3.5 web forms. I've recently saved the path of my website in the web.config file under the key "CommonPath". I have a basic static HTML page that I would like to utilize this key on. Any suggestions on how to achieve ...

Utilize JavaScript or jQuery to segment HTML elements

Looking for a front-end solution to a common practice. In the past, I've stored reusable HTML elements (such as <nav>, <header>, <footer>, etc.) in a functions.php file and used PHP functions to include them on multiple pages. This ...

Arranging Content with Bootstrap Columns

I am trying to organize my content into three sections as follows: A - main content of page B - very important content (must be visible without scrolling) C - less important content. The current layout I have is like this: ----- |A|B| |A|C| ----- Howe ...

Why does one of the two similar javascript functions work while the other one fails to execute?

As a new Javascript learner, I am struggling to make some basic code work. I managed to successfully test a snippet that changes text color from blue to red to ensure that Javascript is functioning on the page. However, my second code attempt aims to togg ...

send a value through the span input box

I have a form with a submit button. After implementing jQuery, the page will display: for(var i=0 ; i <10 ; i++){ '<span class="ioAddConcept">'+ currentConcept[i] +'</span>\n\ with\n&bsol ...

Printing the HTML Template of a widget with multiple loops results in a blank first page being displayed

I have encountered an issue while working with a table and ng-repeat loops in my report widget. The table displays fine on the screen, but when I try to print it, there is always a blank page at the beginning. Interestingly, if I remove the second and thir ...

Utilize a single image to encompass the entire background/theme

As a beginner, I am eager to learn how to use html and css. I understand the importance of being able to style an entire webpage in order to prevent issues like page overload or cache problems. Are there any easy-to-understand examples available for begi ...

AngularJs and graph representation

After attempting to generate charts using angular-chart, I followed all the necessary steps and requirements outlined in the documentation. However, upon completion, my canvas element failed to display any content. My HTML Layout: Here is a snippet of my ...