2013-10-12 3 views
3

저는 지금 몇 가지 작업을하고 있습니다.CSS 이미지 위에 텍스트를 더 가깝게 보이게하십시오.

기본적으로 내가하려는 것은 내 이미지 위에 검은 불투명 한 "화면"을 넣는 것이므로 너무 밝지 않으므로 이미지 위에 텍스트의 내용을 읽을 수 있습니다.

예는 여기 특집 :

enter image description here

이 내가 현재 가지고있는 것입니다.

<div class="overlay"> 
    <span class="front-coffee block"></span> 
    <p class="center">Coffee Shop</p> 
</div> 

div.overlay{background: black; z-index: 5; width:100%; height:100%;} 
.block { display: block; } 
div.popularCategory p{font-size: 24pt; color: white; margin-top:-50px} 
span.front-coffee{background:url('../img/categories/coffee.jpg') no-repeat center; zoom:0.65; width:100%; height:100%; z-index: 4} 
+0

이 지정되지 않은 부모 DIV의 높이와 너비 같은 경우에 다른 뭔가를 반환 100 %로 폭과 높이를 픽셀 단위로 제공하려고 :

그래서 여기 사진 (Cross Browser Image Blur with CSS)를 흐리게하는 방법은 다음과 같습니다. –

+0

할 것이다, 기다려라. 그러면 나는 당신에게 앙갚음을 할 것이다! –

+0

아무 소용이 없다, 그것은 작동하지 않았다! 그러나 오버레이 클래스의 게시물을 편집했습니다. –

답변

4

만약 내가 당신을 올바르게 잡았다면 텍스트가 사용자에게 보여지지 않는 약간의 사진을 희미 해 볼 수 있습니다.하지만이 접근법과 접근 방식은 방화 광명이나 다른 것을 통해 변경 될 수 있습니다. 텍스트가 사용자에게 보이기 때문에 다소 불안정합니다. 내가 고칠 생각하는 가장 좋은 방법은 아무도 원래 이미지를 볼 수 없도록 사진을 편집하고 오버레이를 maunally 추가하는 것입니다.

img { 
    width:367; 
    height:459px; 
    -webkit-filter: blur(3px); //change the value according to what suits the best 
    -moz-filter: blur(3px); //change the value according to what suits the best 
    -o-filter: blur(3px); //change the value according to what suits the best 
    -ms-filter: blur(3px); //change the value according to what suits the best 
    filter: blur(3px); //change the value according to what suits the best 
} 
+1

정말 멋져 보인다! 고맙습니다. 포토샵 등에서 수동으로 편집했지만 400 장의 사진을 편집하지 않아도됩니다. –

+0

@Rob Anytime !!! –

+0

OP가 요청한 것이 실제로는 아니지만 오버레이가 표시되지 않습니다. 그리고 흐림에 대한 지원은 그렇게 크지 않습니다. 대신에 svg 필터를 사용해보십시오 : http://stackoverflow.com/questions/15803122/filter-blur1px-doesnt-work-in-firefox-ie-and-opera#answer-15813429 – Pevara

0
<div class="front-coffee block"> 
    <img src='//image goes here' border='0' /> 
</div> 

// CSS이 도움이

.front-coffee { 
     //Your CSS here 
     background: rgba(0, 0, 0, 0.8); //If put against a lighter background, this will give a nice transition effect towards a lighter gray colour. This is absolutely not needed. But I suggest having at least 1 solid layer behind your opaque image. 
     } 
.front-coffee img { 
     opacity: 0.7; // This will ensure that all images will have an opacity set to 70% . 
     } 

희망.

+1

이상한 3D 효과가 생성 된 것 같습니다. http://imgur.com/5j98yPl –

+0

당신은 배경을 여전히 span.front-coffee에 설정했을 가능성이 큽니다. 하지만 네가 네 대답을 얻은 걸 안다. –

관련 문제