Membuat Sub Menu

Membuat Sub Menu
20 May 2019 7 Comments pemrograman2 Site Default

Untuk membuat sub menu kita menggunakan css menu boleh dipisah boleh di gabung dengan kodingan contoh kausu digabung seperti dibawah

<!DOCTYPE html>
<html>
<head>
 
	<title>Membuat Menu Dropdown Dengan CSS3 dan HTML5</title>
 
</head>
<body>
 
	<style type="text/css">
	html,body{
		padding: 0;
		margin:0;
		font-family: sans-serif;
	}
 
	.menu-malasngoding{
		background-color: #3141ff;
	}
 
	.menu-malasngoding ul {
		list-style-type: none;
		margin: 0;
		padding: 0;
		overflow: hidden;
	}
 
	.menu-malasngoding > ul > li {
		float: left;
	}
 
	
	.menu-malasngoding li a {
		display: inline-block;
		color: white;
		text-align: center;
		padding: 14px 16px;
		text-decoration: none;
	}
 
	.menu-malasngoding li a:hover{
		background-color: #2525ff;
	}
 
	li.dropdown {
		display: inline-block;
	}
 
	.dropdown:hover .isi-dropdown {
		display: block;
	}
 
	.isi-dropdown a:hover {
		color: #fff !important;
	}
 
	.isi-dropdown {
		position: absolute;
		display: none;
		box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
		z-index: 1;
		background-color: #f9f9f9;
	}
 
	.isi-dropdown a {
		color: #3c3c3c !important;
	}
 
	.isi-dropdown a:hover {
		color: #232323 !important;
		background: #f3f3f3 !important;
	}
</style>
 
 
<header class="header">
	<div class="menu-malasngoding">
 
		<ul>
			<li><a href="#">Home</a></li>
			<li><a href="#">Menu 1</a></li>
			<li><a href="#">Menu 2</a></li>
			<li class="dropdown"><a href="#">Menu 3</a>
				<ul class="isi-dropdown">
					<li><a href="#">Sub Menu 1</a></li>
					<li><a href="#">Sub Menu 2</a></li>
					<li><a href="#">Sub Menu 3</a></li>
					<li><a href="#">Sub Menu 4</a></li>
				</ul>
			</li>
			<li><a href="#">Menu 4</a></li>
		</ul>
 
	</div>
</header>
 
<br/>
 
<center>
	<h1>Membuat Menu Dropdown Dengan CSS3 dan HTML5 <br/> www.malasngoding.com</h1>
</center>
 
</body>
</html>

dan untuk kasus tidak digabung kita gunakan sebuah css denga nama yang kita suka, disini saya menggunakan nama style.css

	html,body{
		padding: 0;
		margin:0;
		font-family: sans-serif;
	}
 
	.menu-malasngoding{
		background-color: #3141ff;
	}
 
	.menu-malasngoding ul {
		list-style-type: none;
		margin: 0;
		padding: 0;
		overflow: hidden;
	}
 
	.menu-malasngoding > ul > li {
		float: left;
	}
 
	
	.menu-malasngoding li a {
		display: inline-block;
		color: white;
		text-align: center;
		padding: 14px 16px;
		text-decoration: none;
	}
 
	.menu-malasngoding li a:hover{
		background-color: #2525ff;
	}
 
	li.dropdown {
		display: inline-block;
	}
 
	.dropdown:hover .isi-dropdown {
		display: block;
	}
 
	.isi-dropdown a:hover {
		color: #fff !important;
	}
 
	.isi-dropdown {
		position: absolute;
		display: none;
		box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
		z-index: 1;
		background-color: #f9f9f9;
	}
 
	.isi-dropdown a {
		color: #3c3c3c !important;
	}
 
	.isi-dropdown a:hover {
		color: #232323 !important;
		background: #f3f3f3 !important;
	}

dan pada bagian view buatlah seperti berikut !

<!DOCTYPE html>
<html>
<head>
 
	<title>Membuat Menu Dropdown Dengan CSS3 dan HTML5</title>
<link rel="stylesheet" type="text/css" href="<?php echo base_URL()?>asset/css/style.css" rel="stylesheet">
 
</head>
<body>
 
<header class="header">
	<div class="menu-malasngoding">
 
		<ul>
			<li><a href="#">Home</a></li>
			<li><a href="#">Menu 1</a></li>
			<li><a href="#">Menu 2</a></li>
			<li class="dropdown"><a href="#">Menu 3</a>
				<ul class="isi-dropdown">
					<li><a href="#">Sub Menu 1</a></li>
					<li><a href="#">Sub Menu 2</a></li>
					<li><a href="#">Sub Menu 3</a></li>
					<li><a href="#">Sub Menu 4</a></li>
				</ul>
			</li>
			<li><a href="#">Menu 4</a></li>
		</ul>
 
	</div>
</header>
 
<br/>
 
<center>
	<h1>Membuat Menu Dropdown Dengan CSS3 dan HTML5 <br/> www.malasngoding.com</h1>
</center>
 
</body>
</html>

disini saya menggunakan

<link rel="stylesheet" type="text/css" href="<?php echo base_URL()?>asset/css/style.css" rel="stylesheet">

karena saya menyimpan style.css pada direktori asset/css pada folder cssnya.

About The Author
Leave Comment
  1. 1

    kia replacement key cost

    I am glad that I discovered this website, precisely the right info that I was searching for!

  2. 1

    auto locksmith audi

    I really like looking at and I believe this website got some really useful stuff on it!

  3. 1

    payday loan online

    I am also commenting to let you know of the great encounter my friend’s daughter found reading through your web page. She figured out numerous issues, not to mention what it’s like to have an amazing giving mood to have men and women really easily have an understanding of selected hard to do subject areas. You really exceeded our own expectations. Many thanks for imparting the interesting, safe, explanatory and even easy thoughts on the topic to Janet.

  4. 1

    finasteride cost

    I happen to be writing to make you understand what a wonderful experience our princess went through visiting yuor web blog. She realized too many things, with the inclusion of what it is like to possess an incredible teaching style to make the rest without problems understand various very confusing topics. You undoubtedly surpassed visitors’ expected results. Thanks for supplying those warm and helpful, trustworthy, revealing not to mention unique tips on your topic to Tanya.

  5. 1

    amitriptyline online

    Thanks for your entire labor on this web site. My mother take interest in participating in research and it is simple to grasp why. My spouse and i notice all regarding the powerful tactic you produce useful thoughts via your website and in addition recommend response from the others on this subject then our own princess is undoubtedly studying a whole lot. Take pleasure in the rest of the year. You have been performing a terrific job.

  6. 1

    effexor no rx

    My husband and i ended up being comfortable Albert could carry out his basic research because of the ideas he acquired from your blog. It’s not at all simplistic just to always be freely giving guidance many others could have been making money from. And now we already know we’ve got the blog owner to appreciate because of that. All of the explanations you’ve made, the easy website navigation, the relationships your site make it possible to promote – it is mostly unbelievable, and it is making our son in addition to us understand this topic is satisfying, which is certainly very vital. Thanks for the whole thing!

  7. 1

    wellbutrin cheap

    I’m also commenting to let you be aware of of the excellent discovery my cousin’s child enjoyed checking your blog. She discovered a wide variety of details, most notably how it is like to have a marvelous coaching heart to get many more easily fully understand certain complicated matters. You actually did more than my desires. I appreciate you for delivering such great, healthy, educational and also cool guidance on that topic to Evelyn.

Leave a reply

Your email address will not be published.