تصميم جميل للقسم مع صورة وعنوان ممتلئ جزئيًا به
مثال:
Html:
<div class="sec-wr">
<div class="bg-img"></div>
<div class="sec-text">
<div class="sec-f">Gems of War</div>
<div class="sec-s">Puzzle RPG</div>
</div>
<div class="sec-text-d">
<div class="sec-f">Gems of War</div>
<div class="sec-s">Puzzle RPG</div>
</div>
</div>
Css:
.sec-wr {
display: grid;
grid-template-columns: 1fr 1fr;
height: 500px;
max-width: 1000px;
margin: 20px auto;
position: relative;
}
.bg-img {
grid-area: 1/1/2/2;
background: url("https://i.ibb.co/mBC246S/25.webp");
background-size: auto 500px;
background-repeat: no-repeat;
background-position: 0 40%;
border-radius: 40px;
}
.sec-text {
grid-area: 1/1/-1/-1;
background:url("https://i.ibb.co/mBC246S/25.webp");
-webkit-background-clip: text;
background-clip: text;
background-size: auto 900px;
background-repeat: no-repeat;
background-position: 0 50%;
margin: 0;
padding: 60px 26px 0 26px;
position: relative;
}
.sec-f,
.sec-s {
color: transparent;
text-align: right;
font-family: impact, sans-serif;
text-transform: uppercase;
font-weight: bold;
font-size: 150px;
line-height: 1;
}
.sec-text-d {
position: absolute;
padding: 60px 26px 0 26px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
.sec-text-d .sec-f,
.sec-text-d .sec-s {
content: attr(data-text);
text-align: right;
clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
color: white;
text-shadow: 0 0 12px #000;
}
.sec-s {
font-family: Tahoma, sans-serif;
font-size: 73px;
line-height: 1;
}
@media screen and (max-width: 1000px){
.sec-wr {
width: 100%;
height: 400px;
margin: auto;
}
.sec-f {
font-size: 100px;
}
.sec-s {
font-size: 60px;
}
}
@media screen and (max-width: 680px){
.sec-wr {
height: 320px;
}
.bg-img,
.sec-text {
background-size: auto 460px;
}
.sec-f {
font-size: 90px;
}
.sec-s {
font-size: 40px;
}
}
@media screen and (max-width: 580px){
.sec-f {
font-size: 60px;
}
.sec-s {
font-size: 40px;
}
}
@media screen and (max-width: 480px){
.sec-wr {
grid-template-columns: 1fr;
}
.bg-img {
background-size: auto 320px;
}
.sec-text {
display: none;
}
.sec-text-d .sec-f,
.sec-text-d .sec-s {
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
.sec-f {
font-size: 40px;
}
.sec-s {
font-size: 26px;
}
}