Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Blur/ Frost any image with content on top

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #187261
    AggressiveSimon
    Participant

    Hello,
    I want to use pure CSS3 to blur any image with a frost, but still have content on top of it. Below is the code I have so far.

    <div class="container">
        <div class="frost"></div>
        <div class="content"><p>Dont Blur Me</p></div>
    </div>
    .container {
        height:300px;
        width:300px;
        position: relative;
        background-image: url(https://i.imgur.com/4eair9X.jpg);
    }
    .frost {
        content:"";
        -webkit-filter: blur(10px);
        height: 100%;
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.5);
        
    }
    
    .content{
        height: 100%;
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .content p {
    margin-top: 50%;
    text-align: center;
    }
    #187262
    Paulie_D
    Member

    Could you make a Codepe.io demo.

    You should be aware that the filter property has limited support tough.

    #187263
    AggressiveSimon
    Participant

    I tried but for some reason it failed, so here is a fiddle instead.
    http://jsfiddle.net/2gbkmedu/2/

    Edit: Here is the codepen
    http://codepen.io/anon/pen/clJDp

    #187265
    Paulie_D
    Member

    Try this

    CODEPEN REMOVED AS ACCIDENTALLY OVERWRITTEN

    #187266
    AggressiveSimon
    Participant

    Thank you Paulie. How does a radial gradient achieve this effect?

    Is it possible to make it have a solid border?

    Edit:
    So I have made it 100% width and height, how can the blur? go all the way to the edge without leaving a white space?
    http://codepen.io/anon/pen/qInDE

    #187267
    Paulie_D
    Member

    How does a radial gradient achieve this effect?

    It doesn’t as such. the image is blurred using the filter property…the gradient just adds a layer of “frosting”.

    The ‘white-space was just the margin I put on the container

    A border…on what?

    Ideally an image of what you are trying to achieve would be useful rather that me having to guess…

    #187273
    AggressiveSimon
    Participant

    The image linked below shows the desired effect and the current effect.
    http://i.imgur.com/rmHu78e.png

    #187274
    Paulie_D
    Member

    Oh…I just remove the gradient…it looks more like what you are after:

    http://codepen.io/Paulie-D/pen/EnxKy

    #187275
    AggressiveSimon
    Participant

    I forgot to add the gradient into the image.
    The point was that one image has a soft border, and the other does not. It is the latter effect which I am attempting to achieve.

    #187279
    Paulie_D
    Member

    Guess I’m just not getting what you are after.

    http://codepen.io/Paulie-D/pen/lCEce

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘CSS’ is closed to new topics and replies.