이미지에 tinted-image
클래스가있을 때마다 투명한 빨간색 오버레이를 추가하려고합니다. CSS로 처리하려고합니다. 사실, 직접 적용하려면 img
태그를 사용하고 싶습니다. 이것이 가능한가?CSS로 이미지의 색상 레이어를 오버레이합니다
<img class="tinted-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/owl1.jpg"></img>
그리고 CSS :
나는이 시도.tinted-image {
background:
/* top, transparent red */
linear-gradient(
rgba(0, 255, 0, 0.45),
rgba(0, 255, 0, 0.45)
)
}
을 그리고 아무 일도 발생하지 않습니다.
아래처럼 div를 사용하고 싶지 않습니다. 내가 직접 img 태그에서 구현하려고합니다.
<div class="tinted-div"></div>
.tinted-div {
width:200px;
height:200px;
background:
/* top, transparent red */
linear-gradient(
rgba(0, 255, 0, 0.45),
rgba(0, 255, 0, 0.45)
),
/* bottom, image */
url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/3/owl1.jpg);
}
누군가 도와주세요. :(
가능한 중복 http://stackoverflow.com/questions/12546499/tint-image-using-css-without-overlay) –