Greetings. I can’t find HOW to make the background blurred with css, I assume that beautifully with css is not yet possible.
For example, a block of 6 modules.
- I wanted to apply a blur for the background, when hovering, the blur (filter: blur) disappears, the burgundy translucent fill is: before, if you apply a blur to a class, the pseudo: before or: after will also blur, but this does not suit me. You need to blur only the background. How to do it? (Without javascript)
- In the second block, I decided to try to add a block inside the block, and add a block to blur the background. I do not know how to apply it with the effect: hover
- In the third case, I did: after with the text and: before with a blurred background. It is also not clear how to apply this to: hover
body{margin:0;padding:0;} .portfolio{ margin:0 auto; margin-top:50px; width:100%; min-height:450px; background:#ccc; display:grid; grid-template-columns:200px 200px 200px; grid-template-areas: "cell-1 cell-2 cell-3" "cell-4 cell-5 cell-6"; grid-template-rows:200px 200px; justify-content:center;/*вырванивание блоков по центру*/ align-content: center;/*прижимает блоки друг к другу*/ } .cell{ width:200px; /height:200px;/*включить если не указывать количество и высоту строк*/ background:pink; border:1px solid #444; position:relative; overflow:hidden; } .cell{margin-top:-1px;} .cell-1{grid-are:cell-1;} .cell-2{grid-area:cell-2;} .cell-3{grid-area:cell-3;} .cell-4{grid-area:cell-4;} .cell-5{grid-area:cell-5;} .cell-6{grid-area:cell-6;} @media screen and (max-width:640px){ .portfolio{ padding:20px 0; grid-template-columns:200px 200px; justify-content:center;/*вырванивание блоков по центру*/ grid-template-rows:repeat(3,200px); grid-template-areas: "cell-1 cell-2" "cell-3 cell-4" "cell-5 cell-6"; } } @media screen and (max-width:418px){ .portfolio{ padding:20px 0; justify-content:center;/*вырванивание блоков по центру*/ grid-template-columns:200px; grid-template-rows:repeat(6,200px); grid-template-areas: "cell-1" "cell-2" "cell-3" "cell-4" "cell-5" "cell-6"; } } /*position end-----------------------*/ .cell{ background: /*linear-gradient(/-----------------фон для текста внизу/ to bottom, transparent 80%, rgba(0,0,0,0.4) 80%),*/ url(http://vic4884g.bget.ru/img/421H.jpg) no-repeat center; background-size:cover; } /*cell-1-------------------------------*/ .cell-1{-webkit-backdrop-filter: blur(10px);} .cell-1:before{ content:"some text"; font-size:30px; color:#fff; text-align:center; padding-top:80px;/*сдвигает текст*/ font-family:"Courier New", Courier, monospace; position:absolute; width:200px; height:200px; background:rgba(178, 48, 48,0.5); } /*------------------cell-2*/ .blur{ width:100%; height:100%; background: url(http://vic4884g.bget.ru/img/433H.jpg) no-repeat center; background-size:cover; filter:blur(2px); } .cell-2:after{ content:"some text"; font-size:30px; color:#fff; text-align:center; padding-top:80px;/*сдвигает текст*/ font-family:"Courier New", Courier, monospace; position:absolute; width:200px; height:200px; background:rgba(178, 48, 48,0.5); left:0px; top:0px; } /*cell-3----------------------------------------*/ .cell-3:after{ content:"some text"; font-size:30px; color:#fff; text-align:center; padding-top:80px;/*сдвигает текст*/ font-family:"Courier New", Courier, monospace; position:absolute; width:200px; height:200px; background:rgba(0,0,0,0.5); left:0px; } .cell-3:before{ content:""; position:absolute; width:200px; height:200px; background: url(http://vic4884g.bget.ru/img/421H.jpg) no-repeat center; background-size:cover; filter:blur(5px); } /* :before overflow:hidde; transition:1s; :not(:hover) */ <div class="wrap"> <div class="portfolio"> <div class="cell cell-1">1</div> <div class="cell cell-2"><div class="blur">2</div></div> <div class="cell cell-3">3</div> <div class="cell cell-4">4</div> <div class="cell cell-5">5</div> <div class="cell cell-6">6</div> </div><!-- portfolio --> </div><!-- wrap --> 