HTML
<div class="dropdown">
<div onclick="myFunction()" class="dropbtn"></div>
<div id="myDropdown" class="dropdown-content">
<a href="#loginScreen" class="mangiare">mangiare</a>
<a class="dormire">dormire</a>
<a class="esplorare">esplorare</a>
<a class="divertirsi">divertirsi</a>
<a class="utilia">utilità</a>
</div>
</div>
JS
<script>
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
CSS
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
top: 180px;
background-color:transparent;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
text-align:center;
border: 6px solid #FFFFFF;
border-radius:30px;
font-family: "Century Gothic";
}
.dropdown-content a {
color:#FFFFFF;
padding: 14px 10px;
text-decoration: none;
display: block;
font-size: 18px;
}
.mangiare {
border-bottom:4px solid #FFFFFF;
background-color: rgba(193,39,45,1);
}
.mangiare:hover {
background-color: rgba(240,51,59,1.00);
transition:0.4s;
}
.dormire {
border-bottom:4px solid #FFFFFF;
background-color:#009245;
}.dormire:hover {
background-color:#02C25D;
transition:0.4s;
}
.esplorare {
background-color: #01A2FF;
border-bottom:4px solid #FFFFFF;
}
.esplorare:hover {
background-color: #4CBDFF;
transition: 0.4s;
}
.divertirsi {
background-color: #662D91;
border-bottom:4px solid #FFFFFF;
}
.divertirsi:hover {
background-color: #8037B7;
transition: 0.4s;
}
.utilia {
background-color:#FBB03B;
}
.utilia:hover {
background-color:#FBBD5C;
transition:0.4s;
}
.show {display:block;}
Ho provato a postarlo... si vede?