s

hide a div when an HTML page is viewed on a mobile device edit button Edit

author
Murugan Andezuthu Dharmaratnam | calendar 09 January 2024 | 80

To hide a div when an HTML page is viewed on a mobile device, you can use CSS media queries. These queries allow you to apply specific styles based on the conditions such as screen size.

CSS Code

@media only screen and (max-width: 768px) {
    .your-div-class {
        display: none;
    }
}