The div element should only be hidden on mobile devices

I've been attempting to hide a div on mobile devices using a media query, but unfortunately, it's not working as expected. When I resize the window smaller than (min-width: 1224px), the content disappears instead of being hidden.

Here is a snippet of the CSS code:

/* Styles for Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width: 320px)
and (max-device-width: 480px) {    
  .container {
    display: none;
  }    
}

/* Styles for iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width: 768px)
and (max-device-width: 1024px) {    
  .container {
    display: flex;
    height: 100%;
    width: 100%;
  }
...

And here is a snippet of the HTML code:

<div class="container">
  <div class="logo-container">
    <img src="assets/images/micarna.svg"/>
  </div>
  <div class="sign-in-container">
    <div class="sign-in-form">    
      <div class="ui attached message">
        ...
      </form>    
    </div>
  </div>
</div>

If you can shed some light on why the document goes blank when the window size is less than (min-width: 1224px), your insight would be greatly appreciated. Thank you!

Answer №1

@media only screen and (min-width: 320px) and (max-width: 480px) {
  //CSS for mobile devices
}

Answer №2

Simply employ

@media (max-width:480px){
  .box{
      hidden;
   }
}

Answer №3

It appears to be hidden due to the following CSS code:

/* Smartphones (landscape) ----------- */
@media only screen
and (min-width: 321px) {

  .container {
    display: none;
  }

}

You have two options: either delete this code or find a way around it.

Answer №4

Ensuring the correct order of your media queries is crucial for effective CSS styling. Check out this helpful post

While it may not be the sole reason for encountering a white screen, fixing the order of your media queries can simplify debugging your css code.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Having trouble with your CSS dropdown menu?

I've been struggling to implement a dropdown menu on my website following an online tutorial. Despite following the steps, I can't seem to get it working. It's frustrating because I want to move on to backend development. Hoping someone can ...

Conceal a certain element in development using CSS

Is there a way to hide the footer section from my webpage without affecting the rest of the content? For example, using something like: "div class="poweredby" display: none", but I'm unsure of the correct method... Here is the spe ...

Can different table headers be inserted under a Colspan?

I have been attempting to insert text above each column in Colspan without success. https://i.sstatic.net/MxQPj.png shows the image of how I want the columns in colspan to be displayed as 1 2 3 4 5 O, but I am unsure of how to achieve this. Here is an exam ...

Combining two divs to share the same linear gradient and shadow effect

Greetings to all our valued partners! I am seeking guidance on how to achieve the following task for a web application I am developing: Within my webapp, I have designed a stylish NavBar similar to the examples depicted in the images (in AdobeXD it is di ...

Having trouble getting the code for sending HTML input fields with an attachment field to work in PHP, jQuery, and Ajax

When a button is clicked, I want to send an email with an optional attachment and display the results above the form fields. I've written the code below, but it's not functioning as expected (no action upon clicking the submit button; unable to c ...

How come WhatsApp is not recognizing my og:tags correctly?

I'm having an issue with my webpage where the og:tags generated for link previews on Facebook work fine, but they can't seem to be scraped by WhatsApp. Even though the tags are correct in the source code of the site, WhatsApp shows an error messa ...

Ensure alignment of gradients between two divs, even if their widths vary

Among my collection of 10 inline divs, each one boasts a unique width and color gradient. While the 45-degree lines are uniform across all the divs, is there a way to ensure that these gradients match seamlessly? I've shared my CSS code snippet below ...

How can we use fetch to grab some data?

I put together an Express application quickly, here's how it looks: const express = require("express"); const app = express(); const port = 3000; app.get("/content/1/", (req, res) => res.send("Thinking about taking out a new loan? Call us today. ...

What are the steps to enlarge the logo in the header of a WordPress website?

I recently added a logo to my website located at www.theestablishmenthairdressing.com, but I am encountering an issue where the logo appears very small in the top-left corner of the header. Upon inspecting the code using Safari, it seems that there is a s ...

Combining Multiple Partial Views with Their Respective View Models in ASP.NET MVC: A Step-by-Step Guide

I am working on a view named Register where I include other views using @Html.Partial("ViewName"). I am curious about how to call other ViewModels from the partial views within this main view. While I know that each ViewModel with its fields can be declar ...

Is there any practical reason to choose tables over CSS for controlling layouts?

As I dive into updating a large amount of code for a web application, I've noticed that tables are heavily used throughout to manage layout. Being relatively new to HTML programming, I find myself questioning the necessity of using tables when CSS co ...

The HTML file is unable to fetch the CSS file because of an incorrect file path

I am encountering an issue with my application that serves HTML, and the code snippet looks like this: // ... var staticPath = config.development.staticFiles; app.get('/category/:catName', function(req, res) { res.sendFile(path.join(__dirnam ...

Placing pictures next to each other in html

I need help with aligning two 380 width images side by side within a 760 width table. I have highlighted the area where I'm having trouble. Can someone assist me with this? Your help is much appreciated! I have marked the section with the comment "I& ...

Can you please explain the purpose of the white space in the HTML code?

Currently, I am working on developing a mobile application, and as I start adding styles, I notice a mysterious blank space that seems to be appearing out of nowhere. Can anyone provide any insights or suggestions to help me troubleshoot this issue? https ...

What is the best way to display an error message for an invalid input using JavaScript?

I am struggling to implement error messages for my form inputs using JavaScript. My attempts so far have not been successful and I need guidance on the correct approach. I want to show an error message and prevent the form from being submitted if any erro ...

Issue with Intel XDK: the document.location.href is directing to an incorrect page

Hello Community of Developers, I have been experimenting with different methods but still haven't found a solution. In my project using Intel XDK, whenever I attempt to change the page using location.location.href = "#EndGame" or similar codes in Java ...

Ways to stop the floating label from blending with the input field

Attempting to incorporate the Bootstrap Material design theme into my project, I have implemented a basic text input field using the code below: <div class="form-control-wrapper"> <input class="form-control empty" type="text"></input> ...

Issue with autoplay slideshow functionality not activating when opened in a new tab

The owl.carousel.js plugin is used for creating a jQuery slideshow. Initially, the slideshow works correctly, but I noticed that the autoplay feature stops working when I open a new tab in Firefox or Chrome. Demo : Demo : $(document).ready(function () ...

Locate all elements containing a specific text string

In an attempt to clean up html-elements, I am searching for specific text strings within 2376 html-documents. The documents have varying doctype standards, with some lacking a doctype altogether (which may not be relevant). I am specifically looking for t ...

ReactJS does not trigger a re-render when changes are made to CSS

I'm curious about the reason why ReactJS does not automatically reapply CSS to child components even when componentDidUpdate() is called. I conducted a small demo where adding a new box doesn't change the color of existing boxes, even though the ...