Unforeseen Issues Arising from Media Queries

Trying out some new styling for different screen sizes based on the bootstrap grid system dimensions. Facing an issue where only certain styles apply while others don't seem to take effect. Here's a snippet of the CSS:

@media only screen
  and (max-width: 767px) {

  div.bm {
    display: none;
  }

  div.br {
    height: 40%;
  }

  div.main-row {
    height: 60%;
  }

  #main-text{
    font-size: 3rem;
    font-weight: 300;
    }
}

@media only screen
  and (max-width:991px)
  and (min-width:767px) {

  div.sm {
    display: none;
  }

  div.main-row {
    height: 100%;
  }

  #main-text{
    font-size: 4.5rem;
    font-weight: 300;
  }

}​

@media only screen
  and (min-width:991px)
  and (max-width:1999px) {

  div.sm {
    display: none;
  }

  div.main-row {
    height: 100%;
  }

  #main-text {
    font-size: 5.5rem;
    font-weight: 300;
  }
}

@media only screen
  and (min-width: 1200px) {

  div.sm {
    display: none;
  }

  div.main-row {
    height: 100%;
  }

  #main-text {
    font-size: 6.5rem;
    font-weight: 300;
  }
}

The issue seems to revolve around the display:none property failing to work, although the #main-text is resizing correctly. Suspecting a syntax error near this line:

@media only screen
  and (min-width:991px)
  and (max-width:1999px) {

This particular segment of code triggers an error due to the use of the stylus CSS preprocessor:

ParseError: stylus/monster.styl:40:8
   36|     font-weight: 300;
   37|   }
   38| }​
   39| 
   40| @media only screen
--------------^
   41|   and (min-width:991px)
   42|   and (max-width:1999px) {
   43| 

expected "indent", got "media"

Can you spot what's causing the error in the code?

Answer №1

Here is an issue that needs to be addressed:

The first point of concern:

@media only screen
  and (min-width:991px)
  and (max-width:1999px)

This range of pixel widths falls between [991; 1999];

Next:

@media only screen
  and (min-width: 1200px)

This range of pixel widths starts from 1200 and continues infinitely;

An inconsistency arises when you compare these two sets of pixel ranges: there exists overlap in elements covered by both media queries, specifically [1200; 1999];

This conflicting setup will lead to errors as both conditions cannot be met simultaneously.

Please investigate similar issues throughout the code base.

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

Incorporating an external script within a Next.js application

I've been having trouble incorporating an external JavaScript source into my Next.js application and I keep encountering the following error: Failed to execute 'write' on 'Document': It isn't possible to write into a documen ...

Break up a list into separate paragraphs and style each word using individual CSS

I have a user-generated paragraph that consists of a list of words separated by commas, such as "dog, cat, hamster, turtle." I want to be able to individually assign attributes to each word in the list. Check out this image for reference In the example i ...

Comparing Zend_Navigation to Zend Layout

Greetings! I am a beginner to Zend Framework, starting with version 1.12. Currently, I am in the process of creating my first website and feeling a bit lost on which path to follow. I have integrated an HTML template as my Zend Layout, where the navigatio ...

Create a dropdown menu option that changes based on the number of items that have been

I need a selection option that displays values 1 to 5. Depending on the selected value, it should generate select options equal to the number selected. For example, if I choose 3, then it should generate 3 select options. Is it possible to loop the ajax in ...

Basic Timer with Visual Background

Struggling to find the right CSS/script for a straightforward countdown timer, Here are the requirements: Countdown in days only, no need for hours, minutes, and seconds Ability to use a custom image as background I've scoured online searches but n ...

What is the proper way to align the menu?

I am currently working on a project that involves integrating a menu (with the background only visible on the left side) and an article template together. The menu can be found here, while the article template is located here. I have tried to combine the ...

Conceal the footer using CSS while the slide is in focus

Trying to figure out a way to hide the footer when a specific container is active: For example, how can I hide the footer when the second and third items are selected as active? <div class="owl-stage"> <div class="owl-item"></div> & ...

Issue with hamburger icon in Bootstrap navbar following height adjustment of the navbar

Although my navbar was functioning properly with the hamburger menu expanding down as expected, I encountered an issue after adjusting the height of the navbar. The hamburger button still worked and expanded the menu, but it only displayed the first item o ...

Why does the Autofocus Attribute in HTML5 fail to work specifically in FireFox when <Form><input> elements are dynamically loaded using Ajax?

While testing the form that I loaded via ajax, I noticed an issue with autofocus on the "c_name" field in Firefox. When I access the form directly, the autofocus feature works as expected, but when loading it with ajax, it doesn't seem to work. Surpri ...

Personalizing/Concealing Navigation Controls

Looking for a way to customize the Navigation in the Pagination Plugin; changing 'First, Prev, Page 1, Page 2, Next, Last' to 'Prev, Next, Page 1 of 2' The documentation suggests using show_first_last set to false to hide 'First/L ...

Horizontal rule spans the full width of the content, appearing within an ordered list

Check out this example to see the issue with the horizontal rule not extending all the way across under the number. I've tried using list-style-position:inside;, but that interferes with positioning the number correctly due to the left image being flo ...

unselect the button using jQuery

I want to trigger a popover when a variable exceeds a certain value, triggered by clicking a button: $(function () { $('[data-toggle="tooltip"]').tooltip({ trigger: 'manual', placement: 'top', titl ...

"Creating visual art with processing in 2D using P5

Recently, I came across a webpage about rendering 2D objects in processing using JavaScript. Here is the link to the page: Upon trying out the example code provided on the page in a new P5 project, I noticed that the code structure looked like this: HTML ...

The ng-class condition is in flux, however, the new style is not being

Attempting to modify the background of the pane in an Ionic application based on the condition of the ng-class as shown. Changing the condition in the code and refreshing the page manually works correctly, but updating the condition from user input does ...

Embrace the power of React using curly brackets!

Today, I made the decision to dive into learning React. Typically, I use Brackets for my coding environment. The first step I took was adding the necessary sources to my HTML code. <html> <head> <link rel="stylesheet" href="styl ...

Animated div or fieldset featuring a multi-step form

I have recently put together a detailed step-by-step guide. Each step is wrapped in its own "fieldset" within a single .html file. To navigate back and forth, I have incorporated javascript into the process. However, as time goes on, I am noticing that th ...

Detecting changes in checkbox states

In my current scenario, I have a section of the screen that can be shown or hidden depending on whether a checkbox is checked. The user can change the state of the checkbox manually or programmatically. The challenge lies in detecting this change and upda ...

What is the best way to prevent blank space when splitting a div into two parts?

Currently in the process of working on a school project that involves creating a website with an integrated database. The foundation for this project is an existing website from a previous assignment, created using PHP/HTML. The layout of my prior website ...

The Bootstrap navigation bar is experiencing functionality issues when viewed on Chrome mobile browsers

I'm currently testing out the bootstrap 3 navbar feature on my meteor application, but I'm encountering some issues specifically on mobile devices. The problem seems to be that the toggle button is not showing up as expected. Interestingly, it wo ...

Using jQuery validation to verify that a minimum of one radio button holds a true value

I have a form with two questions. The first question asks if the product value exceeds a certain fixed amount, and the second question asks if the product value is below that fixed amount. Upon submitting the form, validation should ensure that at least on ...