Kali ini saya akan memberikan script HTML dan CSS untuk membuat layout website sederhana, dengan memanfaatkan Menu Dropdown Superfish yang telah saya posting sebelumnya.
Silahkan ikuti langkah-langkah dibawah ini, atau langsung saja download source code nya pada link yang saya berikan diakhir postingan.
1. Membuat file index.html
<html> <head> <title>Bedah PHP - Layout Website Sederhana</title> <link href="style.css" rel="stylesheet" type="text/css"> <script type="text/javascript" src="js/jquery-1.6.2.min.js"></script> <script type="text/javascript" src="js/superfish.js"></script> </head> <body> <div id="utama"> <div id="header"> <div style="font-size:40px; padding-top:40px; padding-left:35px;"><b>WEB HEADER</b></div> <div style="font-size:15px; padding-top:5px; padding-left:40px;"><b>ABOUT YOUR WEBSITE</b></div> </div> <div id="menu"> <div class="menu-wrap"> <ul class="sf-menu"> <li><a href="#">HOME</a></li> <li><a href="#">NEWS</a> <ul> <li><a href="#">NEWS PILIHAN 1</a></li> <li><a href="#">NEWS PILIHAN 2</a> <ul> <li><a href="#">PILIHAN DALAM 1</a></li> <li><a href="#">PILIHAN DALAM 2</a></li> <li><a href="#">PILIHAN DALAM 3</a></li> </ul> </li> <li><a href="#">NEWS PILIHAN 3</a></li> </ul> </li> <li><a href="#">ARTICLE</a></li> <li><a href="#">TUTORIAL</a> <ul> <li><a href>PHP</a></li> <li><a href>JAVASCRIPT</a></li> <li><a href>HTML</a></li> <li><a href>CSS</a></li> </ul> </li> <li><a href="#">DESIGN</a></li> <li><a href="#">CONTACT</a></li> <li><a href="#">ABOUT</a></li> </ul> </div> </div> <div id="kiri"> <center>WIDGET KIRI</center> </div> <div id="tengah"> <center>CONTENT</center> </div> <div id="kanan"> <center>WIDGET KANAN</center> </div> <div id="footer"> <div id="kotak1"> <li>META 1</li> <li>META 2</li> <li>META 3</li> <li>META 4</li> </div> <div id="kotak2"> <li>FOOTER 1</li> <li>FOOTER 2</li> <li>FOOTER 3</li> <li>FOOTER 4</li> </div> <div id="kotak3"> <li>LINK 1</li> <li>LINK 2</li> <li>LINK 3</li> <li>LINK 4</li> </div> </div> </div> </body> </html>2. Membuat file style.css untuk memperindah tampilan
body{ font-family: 'Anaheim', sans-serif; font-size:15px; } #utama{ background-color:white; width:1100px; height:auto; margin:auto; box-shadow:0px 0px 10px 3px #cbcbcb; border-radius:8px; float:left; margin-top:12px; margin-left:118px; margin-bottom:22px; } #header{ background-color:white; width:1100px; height:150px; border-radius:8px 8px 0px 0px; } #menu{ background-color:white; width:1100px; height:36px; } #kiri{ background-color:white; width:220px; min-height:650px; float:left; } #tengah{ background-color:white; width:656px; min-height:650px; float:left; border-left:2px solid #cbcbcb; border-right:2px solid #cbcbcb; } #kanan{ background-color:white; width:220px; min-height:650px; float:left; } #footer{ background-color:#ececec; color:#686868; width:1100px; height:200px; float:left; border-radius:0px 0px 8px 8px; box-shadow:0px -2px 7px #cbcbcb; margin-top:5px; background: -moz-linear-gradient(#f4f4f3, #e0e0e1); /* FF 3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f4f3), color-stop(100%, #e0e0e1)); /* Safari 4+, Chrome 2+ */ background: -webkit-linear-gradient(top, #f4f4f3, #e0e0e1); /* Safari 5.1+, Chrome 10+ */ background: -o-linear-gradient(#f4f4f3, #e0e0e1); /* Opera 11.10 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1')"; /* IE8+ */ background: linear-gradient(#f4f4f3, #e0e0e1); /* the standard */ } #kotak1{ background-color:; width:250px; height:160px; margin-top:20px; margin-left:65px; padding-left:40px; float:left; } #kotak2{ background-color:; width:250px; height:160px; margin-top:20px; margin-left:25px; padding-left:50px; float:left; } #kotak3{ background-color:; width:250px; height:160px; margin-top:20px; margin-left:70px; padding-left:55px; float:left; } /*** ESSENTIAL STYLES ***/ .sf-menu, .sf-menu * { margin: 0; padding: 0; list-style: none; } .sf-menu { line-height: 1.0; margin-top: 0px; margin-left: 0px; font-family: 'Anaheim', sans-serif; } .sf-menu ul { position: absolute; top: -999em; width: 200px; /* left offset of submenus need to match (see below) */ } .sf-menu ul li { width: 140px; } .sf-menu li:hover { visibility: inherit; /* fixes IE7 'sticky bug' */ } .sf-menu li { float: left; position: relative; } .sf-menu a { display: block; position: relative; } .sf-menu li:hover ul { left: 0; top: 30px; /* match top ul list item height */ z-index: 99; margin-left: -1px; } ul.sf-menu li:hover li ul { top: -999em; } ul.sf-menu li li:hover ul { left: 201px; /*match ul width */ top: -1px; } ul.sf-menu li li:hover li ul { top: -999em; } ul.sf-menu li li li:hover ul { /*left: 10em; match ul width */ top: 0; } /*** DEMO SKIN ***/ .sf-menu { float: left; margin-bottom: 0px; width: 1098px; height: 30px; } .sf-menu li { padding-top:8px; padding-right:30px; padding-left:30px; padding-bottom:7px; border-right:1px solid #fff; /* transition */ transition: background-color .2s linear, color .2s linear, border .2s linear; -moz-transition: background-color .2s linear, color .2s linear, border .2s linear; -o-transition: background-color .2s linear, color .2s linear, border .2s linear; -ms-trasition: background-color .2s linear, color .2s linear, border .2s linear; -webkit-transition: background-color .2s linear, color .2s linear, border .2s linear; } .sf-menu li a{ text-decoration:none; text-shadow: 1px 1px #fff; } .sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ color: #686868; } .sf-menu{ background-color:#ececec; -moz-border-radius: 5px; /* FireFox 1+ */ -webkit-border-radius: 5px;/* Safari 3+, Chrome */ border-radius: 5px; background: -moz-linear-gradient(#f4f4f3, #e0e0e1); /* FF 3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f4f3), color-stop(100%, #e0e0e1)); /* Safari 4+, Chrome 2+ */ background: -webkit-linear-gradient(top, #f4f4f3, #e0e0e1); /* Safari 5.1+, Chrome 10+ */ background: -o-linear-gradient(#f4f4f3, #e0e0e1); /* Opera 11.10 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1')"; /* IE8+ */ background: linear-gradient(#f4f4f3, #e0e0e1); /* the standard */ border: 1px solid #ffffff; box-shadow: 0px 1px 4px #888; } .sf-menu ul { background: #ececec; background-image: -moz-linear-gradient(#f4f4f3, #e0e0e1); /* FF 3.6+ */ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f4f3), color-stop(100%, #e0e0e1)); /* Safari 4+, Chrome 2+ */ background-image: -webkit-linear-gradient(top, #f4f4f3, #d9d9d9); /* Safari 5.1+, Chrome 10+ */ background-image: -o-linear-gradient(#f4f4f3, #e0e0e1); /* Opera 11.10 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#f4f4f3', endColorstr='#e0e0e1')"; /* IE8+ */ background-image: linear-gradient(#f4f4f3, #e0e0e1); /* the standard */ /* border */ -webkit-border-bottom-left-radius: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; -moz-border-radius-bottomright: 5px; -moz-border-radius-bottomleft: 5px; border: 1px solid #ffffff; } .sf-menu li:hover, .sf-menu a:focus { background: #cbcbcb; background-image: -moz-linear-gradient(#e0e0e1, #cbcbcb); /* FF 3.6+ */ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e0e0e1), color-stop(100%, #cbcbcb)); /* Safari 4+, Chrome 2+ */ background-image: -webkit-linear-gradient(top, #e0e0e1, #cbcbcb); /* Safari 5.1+, Chrome 10+ */ background-image: -o-linear-gradient(#e0e0e1, #e0e0e1); /* Opera 11.10 */ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#e0e0e1', endColorstr='#cbcbcb'); /* IE6 & IE7 */ -ms-filter: "progid:DXImageTransform.Microsoft.gradient(startColorstr='#e0e0e1', endColorstr='#cbcbcb')"; /* IE8+ */ background-image: linear-gradient(#e0e0e1, #cbcbcb); /* the standard */ outline: 0; } /*** untuk menghilangkan tanda panah **/ .sf-sub-indicator { position: absolute; display: block; right: .75em; top: 1.05em; /* IE6 only */ width: 10px; height: 10px; text-indent: -999em; overflow: hidden; /* 8-bit indexed alpha png. IE6 gets solid image only */ }
Direktori File |