Menu Dropdown & Tabel Hover
Kali ini saya akan menunjukkan bagaimana cara membuat menu dropdown dan tabel hover.Untuk mengatur tampilan nya saya menambahkan script css agar memiliki tampilan lebih menarik.
HTML :
<html>
<head>
<title>Menu Dropdown & Table Hover</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<ul class="dropmenu">
<li><a href="#1">Menu 1</a>
<ul>
<li><a href="#11">Sub Menu 1</a></li>
<li><a href="#22">Sub Menu 2</a></li>
</ul>
</li>
<li><a href="#2">Menu 2</a>
<ul>
<li><a href="#21">Sub Menu 1</a></li>
<li><a href="#22">Sub Menu 2</a></li>
<li><a href="#23">Sub Menu 3</a></li>
<li><a href="#24">Sub Menu 4</a></li>
</ul>
</li>
<li><a href="#3">Menu 3</a>
<ul>
<li><a href="#31">Sub Menu 1</a></li>
<li><a href="#32">Sub Menu 2</a></li>
<li><a href="#33">Sub Menu 3</a></li>
<li><a href="#34">Sub Menu 4</a></li>
</ul>
</li>
<li><a href="#3">Menu 4</a>
<ul>
<li><a href="#31">Sub Menu 1</a></li>
<li><a href="#32">Sub Menu 2</a></li>
</ul><br />
<h3> Tabel Data Mahasiswa</h3>
<table width='600' cellpadding='5' align='center'>
<tr class='head'>
<th width='44' >No</td>
<th width='44' >NIM</td>
<th width='250' >Nama</td>
<th width='50'>Kelas</td>
<th width='152'>Jurusan</td>
</tr>
<tr class='satu'>
<td align='center'>1</td>
<td>L200130001</td>
<td>Joko</td>
<td align='center'>E</td>
<td align='center'>Informatika</td>
</tr>
<tr class='satu'>
<td align='center'>2</td>
<td>L200130002</td>
<td>Doni</td>
<td align='center'>E</td>
<td align='center'>Informatika</td>
</tr>
<tr class='satu'>
<td align='center'>3</td>
<td>L200130003</td>
<td>Fahrul</td>
<td align='center'>E</td>
<td align='center'>Informatika</td>
</tr>
<tr class='satu'>
<td align='center'>4</td>
<td>L200130004</td>
<td>Hendri</td>
<td align='center'>E</td>
<td align='center'>Informatika</td>
</tr>
<tr class='satu'>
<td align='center'>5</td>
<td>L200130005</td>
<td>Agung</td>
<td align='center'>E</td>
<td align='center'>Informatika</td>
</tr>
</table>
</li>
</ul>
</body>
</html>
CSS :
body{
background:#FFF06A;
color:#000;
}
table, th, td {
border-collapse:collapse;
border:1px solid #999;
font-family:Tahoma, Geneva, sans-serif;
font-size:12px;
margin-left:10%;
}
h3 {
font-family:Tahoma, Geneva, sans-serif;
font-size: 12 px;
font-weight: bold;
text-align:center;
}
.head {
background: rgb(206,220,231); /* Old browsers */
background: -moz-linear-gradient(top, rgba(206,220,231,1) 0%, rgba(89,106,114,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(206,220,231,1)), color-stop(100%,rgba(89,106,114,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(206,220,231,1) 0%,rgba(89,106,114,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cedce7', endColorstr='#596a72',GradientType=0 ); /* IE6-9 */
}
.head th {
padding:10px;
color:#333;
text-shadow:1px 1px 0px #CCC;
font-size:14px;
}
.satu {
background-color:#CECECE;
}
.satu:hover {
background-color:#BADFFE;
font-weight:bold;
cursor:pointer;
}
.dropmenu {
background: #FFA500;
height: 30px;
list-style-type: none;
margin: 0;
padding: 0px;
}
.dropmenu li {
border-right: solid 1px white;
float: left;
height: 30px;
}
.dropmenu li a {
color: #fff;
display: block;
font: 12px arial, verdana, sans-serif;
font-weight: bold;
padding: 9px 20px;
text-decoration: none;
}
.dropmenu li:hover { background: #C0C0C0; position: relative; }
.dropmenu li:hover a { text-decoration: underline; }
.dropmenu li:hover ul {
background-color: #3f4a54;
border: 1px solid grey;
left: 0px;
padding: 3px;
top: 30px;
width: 160px;
}
.dropmenu li:hover ul li { border: none; height: 18px; }
.dropmenu li:hover ul li a {
background-color: #e8edff;
border: 1px solid transparent;
color: #fff;
display: block;
font-size: 11px;
height: 18px;
line-height: 18px;
padding: 0px;
text-decoration: none;
text-indent: 5px;
width: 158px;
padding: 3px;
}
.dropmenu li:hover ul li a:hover {
background: silver;
border: solid 1px #444;
color: #000;
height: 18px;
padding: 3px;
}
.dropmenu ul {
left: -9999px;
list-style-type: none;
position: absolute;
top: -9999px;
}
No comments: