box-shadow와 background-color, border-radius를 잘 조합하여 눈속임 효과를 낼 수 있다.
HTML
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>border radius Inverted</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<a href="https://codepen.io/kristen17/pen/pomgrKp" target="_blank">복합적인 border radius 효과</a>
<ul class="list">
<li class="item">
<div class="img-wrap">
<img src="https://images.unsplash.com/photo-1726998748912-fae1b7ca3191?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
alt="이미지" />
</div>
<div class="btn-wrap">
<button title="버튼" class="btn">+</button>
</div>
</li>
<li class="item sample">
<div class="img-wrap">
<img src="https://images.unsplash.com/photo-1726998748912-fae1b7ca3191?q=80&w=1287&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"
alt="이미지" />
</div>
<div class="btn-wrap">
<button title="버튼" class="btn">+</button>
</div>
</li>
</ul>
</body>
</html>
|
cs |
CSS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
@charset "utf-8";
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
gap: 20px;
min-height:100vh;
background:#ccc;
}
.list {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
gap: 20px;
justify-content:center;
align-content:center;
position: relative;
padding:40px;
background:#fff;
}
.item {
list-style-type: none;
position: relative;
width: 100%;
max-width: 600px;
}
.img-wrap {
position: relative;
overflow: hidden;
width: 100%;
aspect-ratio: 1/1.25;
background: #ccc;
border-radius: 20px;
}
.img-wrap::before,
.img-wrap::after {
content: "";
display: block;
position: absolute;
width: 30px;
aspect-ratio: 1/1;
background: transparent;
border-radius: 0 0 20px 0;
box-shadow: 10px 10px 0 #fff;
}
.sample .img-wrap::before,
.sample .img-wrap::after {
background: rgba(255, 0, 0, 0.158);
box-shadow: 10px 10px 0 rgba(0, 0, 0, .3);
}
.img-wrap::before {
right: 0px;
bottom: 100px;
}
.img-wrap::after {
bottom: 0px;
right: 100px;
}
.img-wrap img {
width: 100%;
height: 100%;
object-fit: cover;
}
.btn-wrap {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
right: 0;
bottom: 0;
width: 100px;
aspect-ratio: 1/1;
background: #fff;
border-radius: 50% 0 20px 0;
}
.sample .btn-wrap{
background: rgba(0, 0, 0, .3);
}
.btn {
display: block;
position: relative;
width: 75%;
aspect-ratio: 1/1;
background: slateblue;
border-radius: 50%;
border: none;
font-size: 40px;
color: #fff;
cursor: pointer;
}
|
cs |
'CSS&JS > 👀Study and Copy' 카테고리의 다른 글
[JS+CSS]Madia님 영상보다가 디자인 예쁜거 구현해보기 (고객의 소리 부분) (0) | 2024.10.04 |
---|---|
[JS]Trello 스타일의 drag & drop 구현하기 (1) | 2024.09.27 |
[LunDev]CSS only marquee slider (0) | 2024.09.19 |
[CSS/JS]Lun Dev 쇼핑몰 이미지 줌 효과 (1) | 2024.09.13 |
[JS]팝업창에 함수를 전달하고, 팝업창의 변수를 부모창에 전달하는 방법. (0) | 2024.04.16 |