HTML
<div class="p-popup-wrap">
<div class="bg p-popup-closebtn"></div>
<div class="p-popup-box">
<div class="p-popup-closebtn p-popup-top-closebtn">
×
</div>
<div class="imgbox">
<img src="/html/img/popup_241220.jpg" alt="">
</div>
</div>
</div>
JS
<script> $(".p-popup-closebtn").click(function(){ $(".p-popup-wrap").hide(); }) </script>
CSS
.p-popup-wrap{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
z-index: 999;
}
.p-popup-wrap .bg{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.5);
z-index: 1;
}
.p-popup-wrap .p-popup-box{
max-width: 600px;
width: 100%;
height: auto;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%);
z-index: 2;
}
.p-popup-wrap .p-popup-box img{
max-height: calc(100vh - 80px);
max-width: 600px;
display: block;
margin: 0 auto;
}
.p-popup-wrap .p-popup-top-closebtn{
position: absolute;
top: 0;
right: 0;
transform: translateY(-100%);
-webkit-transform: translateY(-100%);
font-size: 40px;
font-weight: 400;
color: #fff;
cursor: pointer;
z-index: 2;
}
@media(max-width:1024px){
.p-popup-wrap .p-popup-box{
width: calc(100% - 20px);
}
.p-popup-wrap .p-popup-box img{
max-width: 100%;
}
.p-popup-wrap .p-popup-top-closebtn{
font-size: 26px;
}
}
'Front-end > HTML' 카테고리의 다른 글
[HTML] Select Option 시/구 선택 | optgroup 활용 (1) | 2024.09.21 |
---|---|
[HTML] img src 없을 때 대체이미지 출력방법 (0) | 2024.07.26 |
[노마드코더] 신박한 HTML 태그 5개!! (0) | 2022.03.09 |
댓글