Selasa, Mei 14, 2013

Navigation Menu with HTML5 and CSS3

HTML :
<div id="wrapper">

<img class="center" src="title.png" alt="" />

<nav id="nav">
    <ul id="navigation">
        <li><a href="#" class="first">Home</a></li>
        <li><a href="#">Services &raquo;</a>
            <ul>
                <li><a href="#">Web Development</a></li>
                <li><a href="#">Logo Design</a></li>
                <li><a href="#">Identity & Branding &raquo;</a>
                    <ul>
                        <li><a href="#">Business Cards</a></li>
                        <li><a href="#">Brochures</a></li>
                        <li><a href="#">Envelopes</a></li>
                        <li><a href="#">Flyers</a></li>
                    </ul>                   
                </li>                   
                <li><a href="#">Wordpress</a></li>
            </ul>
        </li>
        <li><a href="#">Portfolio &raquo;</a>
            <ul>
                <li><a href="#">Graphic Design</a></li>
                <li><a href="#">Photography</a></li>
                <li><a href="#">Architecture</a></li>
                <li><a href="#">Calligraphy</a></li>
                <li><a href="#">Film &raquo;</a>
                    <ul>
                        <li><a href="#">John Carter</a></li>
                        <li><a href="#">The Avengers</a></li>
                        <li><a href="#">The Amazing SpiderMan</a></li>
                        <li><a href="#">Madagascar 3</a></li>
                    </ul>                       
                </li>
                <li><a href="#">Graffity </a></li>
            </ul>               
        </li>
        <li><a href="#">Testimonials</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#" class="last">Contact</a></li>
    </ul>
</nav>

</div><!--end wrapper-->
CSS :
/* css reset - makes the layout looking good in all browsers */
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
    display: block; }
body {
    line-height: 1;
    font:12px/20px Arial;
    /*background:#e0f3ff; */
    background:url(pattern.png) repeat scroll 0 0;
    }
ol, ul {
    list-style: none; }
.center {
    margin:50px 0 0 190px;
    width:240px;
   
}
h1 { font-size:30px; margin:130px 0 0 0; text-align:center;
    font-weight:bold;
    color:#777777;
    text-shadow: 1px 2px 0 #ffffff, 2px 4px 0 #d6d6d6;
}
   
#bar {
    background-color: #2f2f2f;
    bottom: 0;
    border-top:2px solid #eeeeee;
    height: 50px;
    left: 0;
    position: fixed;
    width: 100%;
    z-index: 100000;
    display:block;
}

#innerbar {
    width:900px;
    margin:0 auto;
}

#innerbar h2 {
    color: #bdbdbd;
    font-size: 14px;
    font-weight: normal;
    padding: 13px 0 0;
    text-align:center;
    margin:0;
    padding-top:16px;
}

#innerbar a {
    color:#fff;
}

#wrapper{
    width:620px;
    margin:0 auto;
}

#nav {
    position:relative;
    width:620px;
    margin:0 auto;
    margin-top:10px;
    padding:10px;
}

ul#navigation {
    margin:0px auto;
    position:relative;
    float:left;
    border-left:1px solid #c4dbe7;
    border-right:1px solid #c4dbe7;
}

ul#navigation li {
    display:inline;
    font-size:12px;
    font-weight:bold;
    margin:0;
    padding:0;
    float:left;
    position:relative;
    border-top:1px solid #c4dbe7;
    border-bottom:2px solid #c4dbe7;
}

ul#navigation li a {
    padding:10px 25px;
    color:#616161;
    text-shadow:1px 1px 0px #fff;
    text-decoration:none;
    display:inline-block;
    border-right:1px solid #fff;
    border-left:1px solid #C2C2C2;
    border-top:1px solid #fff;
    background: #f5f5f5;
   
    -webkit-transition:color 0.2s linear, background 0.2s linear;  
    -moz-transition:color 0.2s linear, background 0.2s linear;  
    -o-transition:color 0.2s linear, background 0.2s linear;  
    transition:color 0.2s linear, background 0.2s linear;  
}

ul#navigation li a:hover {
    background:#f8f8f8;
    color:#282828;
}

ul#navigation li:hover > a {
    background:#fff;
}

/* Drop-Down Navigation */
ul#navigation li:hover > ul
{
    visibility:visible;
    opacity:1;
}

ul#navigation ul, ul#navigation ul li ul {
    list-style: none;
    margin: 0;
    padding: 0;   
    visibility:hidden;
    position: absolute;
    z-index: 99999;
    width:180px;
    background:#f8f8f8;
    box-shadow:1px 1px 3px #ccc;
    opacity:0;
    -webkit-transition:opacity 0.2s linear, visibility 0.2s linear;
    -moz-transition:opacity 0.2s linear, visibility 0.2s linear;
    -o-transition:opacity 0.2s linear, visibility 0.2s linear;
    transition:opacity 0.2s linear, visibility 0.2s linear;   
}

ul#navigation ul {
    top: 43px;
    left: 1px;
}

ul#navigation ul li ul {
    top: 0;
    left: 181px;
}

ul#navigation ul li {
    clear:both;
    width:100%;
    border:0 none;
    border-bottom:1px solid #c9c9c9;
}

ul#navigation ul li a {
    background:none;
    padding:7px 15px;
    color:#616161;
    text-shadow:1px 1px 0px #fff;
    text-decoration:none;
    display:inline-block;
    border:0 none;
    float:left;
    clear:both;
    width:150px;
}

ul#navigation li a.first {
    border-left: 0 none;
}

ul#navigation li a.last {
    border-right: 0 none;
}

5 komentar:

Catatan:
1. Untuk menyisipkan kode,gunakan tag <i rel="pre">Kode Anda</i>
2. Untuk menyisipkan quote,gunakan tag <b rel="quote">Kata-kata Anda</b>
3. Untuk menyisipkan gambar,gunakan tag [img]URL Gambar[/img]
4. Untuk menyisipkan video,gunakan tag [youtube]URL VIDEO ANDA[/youtube]

NB: Jangan menuliskan link aktif karena akan terhapus secara automatis.
Terimakasih atas kunjungannya ke Blog Kolom Tutorial™, Salam M. Alex Junaedi