[모바일] CSS3 로 페이스북같은 사이드바 메뉴 만들기 > 기술자료 | 해피정닷컴

[모바일] CSS3 로 페이스북같은 사이드바 메뉴 만들기 > 기술자료

본문 바로가기

사이트 내 전체검색

[모바일] CSS3 로 페이스북같은 사이드바 메뉴 만들기 > 기술자료

HTML [모바일] CSS3 로 페이스북같은 사이드바 메뉴 만들기

페이지 정보


본문



###########################  mobile_sidebar.css  ###########################

@charset "utf-8";
*{
    margin:0px;
    padding:0px;
    font-family: 'gullim', sans-serif;
}

a {
    text-decoration: none;
}


#pages_wrraper {
    /* overflow: hidden; */
    width: 100%;
    height: 100%;
}


/* 네비게이터 시작 */
.navigator {
    position: absolute;
    top: 0;
    width: 0;
    height: 100%;
    /* background: #3B3B3B; */   /* 왼쪽 네비게이터 배경색 */
    overflow-y: hidden;  
    float: left;
}

.menu {
    width: auto;
    height: auto;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    font-size: 0.8125em;
}

.menu > li > a {
    background-color: #616975;
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(114, 122, 134)),to(rgb(80, 88, 100)));
    background-image: -webkit-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
    background-image: -moz-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
    background-image: -o-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
    background-image: -ms-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
    background-image: linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#727a86', EndColorStr='#505864');
    border-bottom: 1px solid #33373d;
    -webkit-box-shadow: inset 0px 1px 0px 0px #878e98;
    -moz-box-shadow: inset 0px 1px 0px 0px #878e98;
    box-shadow: inset 0px 1px 0px 0px #878e98;
    width: 100%;
    height: 2.75em;
    line-height: 2.75em;
    text-indent: 2.75em;
    display: block;
    position: relative;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0px 1px 0px rgba(0,0,0,.5);
}

.menu ul li a {
    background: #ffffff;
    border-bottom: 1px solid #efeff0;
    width: 100%;
    height: 2.75em;
    line-height: 2.75em;
    text-indent: 2.75em;
    display: block;
    position: relative;
    font-size: 0.923em;
    font-weight: 400;
    color: #878d95;
}
.menu ul li:last-child a {
    border-bottom: 1px solid #33373d;
}

.menu > li > a:hover,
.menu > li > a.active {
    background-color: #35afe3;
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(69, 199, 235)),to(rgb(38, 152, 219)));
    background-image: -webkit-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -moz-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -o-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -ms-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
    border-bottom: 1px solid #103c56;
    -webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    -moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    box-shadow: inset 0px 1px 0px 0px #6ad2ef;
}
.menu > li > a.active {
    border-bottom: 1px solid #1a638f;
}


.menu > li > a:before {
    content: '';
    background-repeat: no-repeat;
    font-size: 36px;
    height: 1em;
    width: 1em;
    position: absolute;
    left: 0;
    top: 50%;
    margin: -.5em 0 0 0;
}

.menu > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    background: #48515c;
    line-height: 1em;
    height: 1em;
    padding: .4em .6em;
    margin: -.8em 0 0 0;
    color: #ffffff;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: .769em;
    border-radius: .769em;
    -webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    -moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    text-shadow: 0px 1px 0px rgba(0,0,0,.5);
    font-weight: 500;
}
.menu > li > a:hover span, .menu > li a.active span {
    background: #2173a1;
}

.menu ul > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    background: #ffffff;
    border: 1px solid #d0d0d3;
    line-height: 1em;
    height: 1em;
    padding: .4em .7em;
    margin: -.9em 0 0 0;
    color: #878d95;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: 769em;
    border-radius: 769em;
    text-shadow: 0px 0px 0px rgba(255,255,255,.01));
}
.menu > li > ul li a:before {
    content: '▶';
    font-size: 8px;
    color: #bcbcbf;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 0;
    left: -2.7em;
}
.menu > li > ul li:hover a,
.menu > li > ul li:hover a span,
.menu > li > ul li:hover a:before {
    color: #32373D;
}

.member_info
{
    height: 3.2em;
    line-height: 3.2em;
    text-indent: 1.75em;
    color: #000;
    background: #e2e2e2;
    text-shadow: #fff 0px -1px 1px;
    font-weight: bold;
}

.member_info > span
{
    background: #fff;
    border: 1px solid #d0d0d3;
    line-height: 1em;
    height: 1em;
    padding: .4em .7em;
    margin: -.9em 0 0 0;
    color: #878d95;
    text-indent: 0;
    -webkit-border-radius: .769em;
    -moz-border-radius: 769em;
    border-radius: 769em;
    text-shadow: 0px 0px 0px rgba(255,255,255,.01));
}

.member_info > span:hover
{
    background: #eeeeee;
}

.copyright
{
    padding: 1.4em .7em;    
    border: 0px;
    color: #fff;
    right: 1em;
    top: 50%;
    line-height: 3.2em;
    text-indent: 0.75em;
    font: 9pt tahoma;
    font-weight: bold;
    background: #3B3B3B;
}

/* 네비게이터 끝 */




#navigator:target {
    width: 220px;             
    overflow: hidden;
}

.close-menu {
    padding: 10px;
    display: none;
}

.open-menu {
    padding: 10px;
    display: block;
}

.open_menu_txt {
    float:left; line-height:20px; width:90%; text-align:center; color:#FFFFFF; font-weight:bold;
}

.main-header { /* 메인 상단 바 */
    background-color: #35afe3;
    background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(69, 199, 235)),to(rgb(38, 152, 219)));
    background-image: -webkit-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -moz-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -o-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: -ms-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    background-image: linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
    filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr='#45c7eb', EndColorStr='#2698db');
    border-bottom: 1px solid #103c56;
    -webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    -moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    line-height: 2.6em;
    text-indent: 0.75em;
}

.main-header > span {
    text-align: center;
}

.page-wrap {
    position: relative;
    width: 100%;                   
}

#navigator:target + .page-wrap {
    left:220px;
    height: 100%;
}

#navigator:target + .page-wrap .open-menu {
    display: none;
    cursor: pointer;
}
#navigator:target + .page-wrap .close-menu {
    display: block;
    cursor: pointer;
}

.navicon-line {
    width: 24px;
    height: 4px;
    border-radius: 1px;
    margin-bottom: 3px;
    background-color: #5fe3ff;  /*  상단 좌우 아이콘 배경색  */
}



########################### test.html ###########################

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=0,maximum-scale=10">
<script type="text/javascript" language = "javascript">
<!--
// 모바일 웹 주소창 숨기기
window.addEventListener('load', function() {
  // body의 height를 살짝 늘리는 코드
  document.body.style.height = (document.documentElement.clientHeight + 5) + 'px';
  // scroll를 제어 하는 코드
  setTimeout(scrollTo, 0, 0, 1);
}, false);
//-->
</script
<title>HappyJung.com</title>
<link rel="stylesheet" href="mobile_sidebar.css">
</head>

<body>
<div id="pages_wrraper">

    <nav class="navigator" id="navigator">
        <div id="wrapper">
            <ul class="menu">
                <li class="member_info">해피정닷컴님 <span>로그아웃</span></li>
                <li class="item1"><a href="#">처음으로 <span>Go</span></a>
                <li class="item2"><a href="#">메뉴1 <span>Go</span></a>
                    <ul>
                        <li class="subitem1"><a href="#">서브메뉴1-1 <span>▶</span></a></li>
                        <li class="subitem2"><a href="#">서브메뉴1-2 <span>▶</span></a></li>
                        <li class="subitem3"><a href="#">서브메뉴1-3 <span>▶</span></a></li>
                    </ul>
                </li>
                <li class="item6"><a href="#">메뉴2 <span>Go</span></a>
                    <ul>
                        <li class="subitem1"><a href="#">서브메뉴2-1 <span>▶</span></a></li>
                        <li class="subitem2"><a href="#">서브메뉴2-2 <span>▶</span></a></li>
                    </ul>
                </li>
                <li class="copyright">
                    Copyright Perm
                </li>
            </ul>
        </div>
    </nav>
    
    <div class="page-wrap">
        <header class="main-header ">
            <a href="#navigator" class="open-menu">
                <div style="float:left; width:10%;">
                    <div class="navicon-line"></div>
                    <div class="navicon-line"></div>
                    <div class="navicon-line"></div>
                </div>
                
                <div class="open_menu_txt">
                    HappyJung.Com
                </div>
                
                <div style="clear:both;">
                </div>
            </a>
            <a href="#" class="close-menu">
                <div style="float:left; width:100px; width:10px;">
                    <div class="navicon-line"></div>
                    <div class="navicon-line"></div>
                    <div class="navicon-line"></div>
                </div>
                
                <div class="open_menu_txt">
                    HappyJung.com
                </div>
                
                <div style="clear:both;">
                </div>
            </a>
        </header>
        <section id="main_pages">
            <!-- 본문시작 -->
            1<br>2<br>3<br>4<br>5<br>
            11<br>12<br>13<br>14<br>15<br>
            21<br>22<br>23<br>24<br>25<br>
            31<br>32<br>33<br>34<br>35<br>
            41<br>42<br>43<br>44<br>45<br>
            51<br>52<br>53<br>54<br>55<br>
            61<br>62<br>63<br>64<br>65<br>
            71<br>72<br>73<br>74<br>75<br>
            81<br>82<br>83<br>84<br>85<br>
            91<br>92<br>93<br>94<br>95<br>
            101<br>102<br>103<br>104<br>105<br>
            111<br>112<br>113<br>114<br>115<br>
            <!-- 본문끝 -->
        </section>
    </div>
</div>
</body>
</html>





참고자료
http://sandro.tistory.com/entry/CSS3-로-페이스북같은-사이드바-메뉴-만들어보기-1기본
http://sandro.tistory.com/entry/CSS3-로-페이스북같은-사이드바-메뉴-만들어보기-2-적용예

댓글목록

등록된 댓글이 없습니다.


Total 2,634건 51 페이지
  • RSS
기술자료 목록
1634
호스팅   21260  2014-12-31 02:37 ~ 2018-12-15 17:45  
1633
HTML   15076  2014-12-22 18:49  
1632
PHP   21921  2014-12-22 15:54  
1631
XML   16830  2014-12-22 15:50  
1630
PHP   27043  2014-12-19 06:50 ~ 2019-12-13 10:05  
1629
그누보드   20645  2014-12-18 17:24 ~ 2024-01-30 14:30  
1628
PHP   16756  2014-12-18 13:24 ~ 2021-07-23 14:01  
1627
그누보드   12020  2014-12-12 13:15 ~ 2020-10-17 06:36  
1626
영카트   14452  2014-12-10 01:05 ~ 2014-12-17 00:00  
열람
HTML   19087  2014-12-09 02:13 ~ 2014-12-09 00:00  
1624
ClassicASP   15099  2014-12-03 15:33  
1623
JavaScript   13792  2014-12-03 13:30  
1622
일반   101726  2014-12-02 01:09 ~ 2017-04-04 00:00  
1621
영카트   18668  2014-11-27 18:33 ~ 2017-06-01 00:00  
1620
일반   20522  2014-11-25 23:17 ~ 2016-09-21 00:00  
1619
HTML   23948  2014-11-25 00:21 ~ 2015-07-27 00:00  
1618
일반   18303  2014-11-20 11:11  
1617
JavaScript   17943  2014-11-15 21:09  
1616
.NET   15966  2014-11-12 14:25  
1615
PHP   26760  2014-11-12 10:28 ~ 2021-11-10 07:19  

검색

해피정닷컴 정보

회사소개 회사연혁 협력사 오시는길 서비스 이용약관 개인정보 처리방침

회사명: 해피정닷컴   대표: 정창용   전화: 070-7600-3500   팩스: 042-670-8272
주소: (34368) 대전시 대덕구 대화로 160 대전산업용재유통단지 1동 222호
개인정보보호책임자: 정창용   사업자번호: 119-05-36414
통신판매업신고: 제2024-대전대덕-0405호 [사업자등록확인]  
Copyright 2001~2024 해피정닷컴. All Rights Reserved.