티스토리 뷰

CSS

탭메뉴 있는 [팝업] : 맥 CSS 만들기

Gayeong's 2022. 4. 17. 18:32

HTML

 <div class="source">
            <button class="source-btn">소스보기</button>
            <div id="modal">
                <div class="modal-wrap">
                    <div class="modal-cont">
                        <div class="code-view">
                            <div class="view-header" aria-hidden="true">
                                <span></span>
                                <span></span>
                                <span></span>
                            </div>
                            <div class="view-title">
                                <ul>
                                    <li class="active"><a href="#">HTML</a></li>
                                    <li><a href="#">CSS</a></li>
                                    <li><a href="#">JavaScript</a></li>
                                </ul>
                            </div>
                            <div class="view-cont">
                                <div>
<pre><code class="language-html">
</code></pre>
                                </div>
                                <!-- //cont1 -->
                                <div>
<pre><code class="language-javascript">
</code></pre>
                                </div>
                                <!-- //cont2 -->
                                <div>
<pre><code class="language-javascript">
</code></pre>
                                </div>
                                <!-- //cont3 -->
                            </div>
                        </div>
                    </div>
                    <button class="modal-close">닫기</button>
                </div>
            </div>
        </div>

CSS

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'NexonLv1Gothic';
}
a {
    text-decoration: none;
    color: #fff;
    transition: all 0.2s;
}
li {
    list-style: none;
}
img {
    width: 100%;
    vertical-align: top;
}
body {
    width: 100%;
    height: 100vh;
    background-image: url(../img/img_slide01.jpg);
    background-size: cover;
    background-position: center center;
    overflow: hidden;
    color: #fff;
}
body.img01 {background-image: url(../img/img_slide01.jpg);}
body.img02 {background-image: url(../img/img_slide02.jpg);}
body.img03 {background-image: url(../img/img_slide03.jpg);}
body.img04 {background-image: url(../img/img_slide04.jpg);}
body.img05 {background-image: url(../img/img_slide05.jpg);}
body.img06 {background-image: url(../img/img_slide06.jpg);}
body.img07 {background-image: url(../img/img_slide07.jpg);}
body.img08 {background-image: url(../img/img_slide08.jpg);}
body.img09 {background-image: url(../img/img_slide09.jpg);}
body.img10 {background-image: url(../img/img_slide10.jpg);}

body::before {
    content: '';
    position: absolute;
    left: 0; 
    top: 0;
    width: 100%; 
    height: 100vh;
    background: rgba(8,31,36,.8);
    z-index: -1;
}
/* info */
.title {
    position: absolute;
    left: 20px;
    top: 20px;
}
.title h1 {
    font-size: 30px;
    border-bottom: 1px dashed #fff;
    margin-bottom: 10px;
    padding-bottom: 5px;
    font-weight: 500;
}
.title p {
    font-size: 16px;
}
.number {
    position: absolute;
    right: 20px; 
    top: 20px;
}
.number li {
    display: inline;
}
.number li a {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 1px dashed #fff;
    border-radius: 20px;
    text-align: center;
    line-height: 30px;
    font-size: 12px;
}
.number li a:hover,
.number li.active a {
    background: #fff;
    color: #000;
}
.source {
    position: absolute;
    right: 20px;
    bottom: 20px;
}
.source button {
    border: 1px solid #fff;
    background: transparent;
    font-family: 'NexonLv1Gothic';
    color: #fff;
    font-size: 16px;
    padding: 10px 30px;
    border-radius: 50px;
    transition: all 0.2s;
    cursor: pointer;
}
.source button:hover {
    background: #fff;
    color: #000
}
.attr {
    position: absolute;
    left: 0;
    bottom: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* modal */
#modal {
    position: fixed;
    left: 0; 
    top: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    transform: scale(0);
}
#modal.show {
    animation: foldOut 1s ease forwards;
}
#modal.show.hide {
    animation: foldIn 1s 0.3s ease backwards;
}
.modal-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    height: 100vh;
    transform: scale(0)
}
#modal.show .modal-wrap {
    animation: zoomOut 0.5s 1s ease forwards;
}
#modal.show.hide .modal-wrap {
    animation: zoomIn 0.5s ease forwards;
}
@keyframes foldOut {
    0%   {transform: scaleX(0) scaleY(0.005)}
    50%  {transform: scaleX(1) scaleY(0.005)}
    100% {transform: scaleX(1) scaleY(1)}
}
@keyframes foldIn {
    0%   {transform: scaleX(1) scaleY(1)}
    50%  {transform: scaleX(1) scaleY(0.005)}
    100% {transform: scaleX(0) scaleY(0.005)}
}
@keyframes zoomOut {
    0%   {transform: scale(0)}
    100% {transform: scale(1)}
}
@keyframes zoomIn {
    0%   {transform: scale(1)}
    100% {transform: scale(0)}
}
.modal-close {
    margin-top: 10px;
}
.modal-cont {
    opacity: 1;
    position: relative;
}
.code-view {
    width: 60vw;
    height: 60vh;
    background: #fff;
    border: 1px solid #f2f2f2;
    border-radius: 5px;
    overflow: scroll;
    overflow-x: hidden;
}
.view-header {
    position: absolute;
    left: 0; top: 0;
    width: 100%;
    height: 32px;
    background: #fff;
    padding: 7px 0 7px 10px;
    border-bottom: 1px solid #eee;
    border-radius: 5px 5px 0 0;
}
.view-header > span {
    width: 10px; 
    height: 10px;
    display: inline-block;
    border-radius: 10px;
}    
.view-header > span:nth-child(1) {
    background-color: #f56565;
}
.view-header > span:nth-child(2) {
    background-color: #f6e05e;
}
.view-header > span:nth-child(3) {
    background-color: #4EBB7B;
}
.view-title {
    position: absolute;
    left: 0; 
    top: 32px;
    width: 100%;
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 9px 0 7px;
    height: 37px;
}
.view-title li {
    display: inline;
}
.view-title li a {
    color: rgb(150, 150, 150);
    font-size: 14px;
    text-transform: uppercase;
    padding: 12px 20px 8px 20px;
    margin: 2px 0 0 0;
}
.view-title li.active a {
    color: #000;
    background: #dcdce4;
}
.view-cont {
    background-color: #282936;
    height: 100%;
    padding-top: 65px;
}
.view-cont > div {
    display: none;
}
.view-cont > div:first-child {
    display: block;
}
.view-cont pre code.hljs {
    line-height: 1.6;
}

 

스크립트 보기 : https://webs-blog.tistory.com/90

'CSS' 카테고리의 다른 글

CSS 속성 display:flex 플렉스 속성  (0) 2022.04.17
[여기] 팝업 만들기  (0) 2022.04.17
CSS 셋팅 - 폰트 font 설정  (0) 2022.04.17
CSS 셋팅 - reset 설정 : 태그의 기본값 초기화  (0) 2022.04.17
CSS 셋팅 - 공통 common 설정  (0) 2022.04.17
댓글
© 2018 webstoryboy