I'm making a website and I've put a "DropDownButton". I would like to be able to click on all the parts of the button, but it only works if I click on the top part of the button. Here is a video of what happens to me: link
Here is the CSS and HTML (there may be a bug in the script, since I am a beginner, if there is, please tell me):
.dropbtn {
background-color: #e0e0e0;
color: black;
padding: 16px;
font-size: 30px;
border: none;
cursor: pointer;
position:fixed;
left: 9px;
top:146px;
width: 15.6%;
height: 55px;
font-family: Times New Roman;
}
}
.text_btn {
position:fixed;
left: 48px;
top:140px;
}
.dropbtn:hover, .dropbtn:focus {
background-color: #4dd6e2;
color:white;
}
.dropbtn_active {
padding: 16px;
font-size: 30px;
border: none;
cursor: pointer;
position:fixed;
left: 9px;
top:146px;
width: 13.3%;
height: 3.6%;
font-family: Times New Roman;
background-color: #309ba5;
color: white;
}
.dropdown {
position: relative;
display: inline-block;
}
.icon_dropdown{
height:30px;
width:30px;
border:0px;
position:fixed;
top:167px;
left:8px;
}
.active {
background-color: #309ba5;
color: white;
}
.dropdown-content {
display: none;
position: fixed;
background-color: #f9f9f9;
min-width: 160px;
overflow: auto;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
left: 10px;
top:202px;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
font-size:27px;
text-align:left;
}
.dropdown a:hover {background-color: #e2e2e2}
.show {display:block;}
<div class="dropdown">
<button onclick="myFunction()" class="dropbtn">
<div class="text_btn">Multimedia</div>
<img class="icon_dropdown" src="dropdown_icon.png" alt="icon_dropdown">
</button>
<div id="myDropdown" class="dropdown-content">
<a href="mp4.html">MP4</a>
<a href="png.html">PNG</a>
<a href="gif.html">GIF</a>
</div>
</div>
<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>