<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<style>
.dropdown > .dropdown-toggle.btn-default:focus{background:gray} .open > .dropdown-toggle.btn-default[aria-expanded=true] {background:red}
</style>
</head>
<body>
<div class="container">
<h2>Dropdowns</h2>
<p>The .dropdown class is used to indicate a dropdown menu.</p>
<p>Use the .dropdown-menu class to actually build the dropdown menu.</p>
<p>To open the dropdown menu, use a button or a link with a class of .dropdown-toggle and data-toggle="dropdown".</p>
<div class="dropdown">
<button class="btn btn-default btncolor1 dropdown-toggle" type="button" data-toggle="dropdown">Dropdown Example
<span class="caret"></span></button>
<ul class="dropdown-menu dropdwn1">
<li><a href="#">HTML</a></li>
<li><a href="#">CSS</a></li>
<li><a href="#">JavaScript</a></li>
</ul>
</div>
</div>
</body>
</html>
.btncolor1 {
background-color:darkred;
color:yellow;
}
.btncolor1:hover,
.btncolor1:focus{
background-color:red;
color:yellow;
}
.open {
background-color:pink;
}
.dropdwn1 {
background-color:lightgreen;
}
.dropdwn1 > li a{
background-color:lightgreen;
color:green;
}
.dropdwn1 > li a:hover{
background-color:green;
color:lightgreen;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.