CSS

css - 배경 오버레이 시키기

닉네임이없어서아무거나지음 2023. 5. 25. 14:11
반응형

HTML

<section class="banner">
	<h1>섹션1 입니다.</h1>
</section>

 

CSS

* {
    margin: 0;
    padding: 0;
}
body {
    margin: 10px;
}
.banner {
    position: relative;
    min-height: 100vh;
    background-image: url(https://images.unsplash.com/photo-1509473332032-f1ce823d92c4?ixlib=rb-0.3.5&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ&s=3e2410208e8f8a78e4aa3550fddfbb44);
    background-size: cover;
    display: flex;
}
.banner:after {
    content: ""; 
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(120deg,#eaee44,#33d0ff);
    background-color: #333;
    opacity: .7;
    mix-blend-mode: hue;
}
.banner > * {
    z-index: 100;
}
h1 {
    margin: auto;  
    font-size: 100px;
    color: blue;
}

 

 

position 유의하여 작업하면 포토샵 없이 간단하게 오버레이 시킬 수 있다

반응형