While working on making my webpage responsive, I discovered that the key CSS modification for responsiveness is the @media rule. However, I am facing an issue with one specific part of the code.
@media (min-width: 768px) and (max-width: 979px) {
.dropdown-content {
margin-left:10%
}
}
The section that corresponds to the tablet window version in the bootstrap-responsive.css is functioning properly. But when I switch to the mobile window version, defined as max-width :767px, the HTML page is not recognizing it.
@media (max-width: 767px) {
.dropdown:hover .dropdown-content {
display:none;
}
}
In the mobile version, this particular code snippet is not being applied. My goal is to utilize the first CSS code during the tablet version and the second CSS code during the mobile version. Is there a link to a JavaScript file that I may be missing or could it be something else? Any help with a solution would be greatly appreciated.
Edit: I have made some changes to the attributes and included additional HTML code below.
<li class="dropdown">
<a href="policies.php">Policy</a>
<div class="dropdown-content">
<!--dropdown-content div-->
</div>
</li>
By default, the dropdown-content attribute is set to:
.dropdown-content{
display:none;
}
When hovering over the dropdown, the following code comes into effect:
.dropdown:hover .dropdown-content{
display:block;
}
However, in the mobile version, I want to hide it again so that hovering on the dropdown does not reveal the dropdown-content.