Media queries function only at the beginning

@media screen and (max-width: 1336px) {
    .rectangle-box {
       visibility: visible;
      }

   #p-cactions {  
    top: 461px; 
    left: 410px; 
      }

}

@media screen and (max-width: 1040px) {
    .rectangle-box {
       visibility: hidden !important;
      }
    #p-cactions {    
    top: 461px !important; 
    left: 1110px !important; 
      }
}

When experimenting with my CSS file, I noticed that certain styles only work when placed at the top of the code, rather than at the bottom. This behavior seemed to occur in reverse in Google Chrome, specifically with the main.css file for the monobook skin in MediaWiki. Although I eventually got it working correctly, this curious inversion puzzled me. It's interesting how the order of styles can affect their functionality.

Answer №1

Avoid making direct edits to main.css or attempting to hack into other code! The outcome could be unpredictable.

Instead, utilize the gadgets extension to easily manage your JS/CSS on your wiki. You can explore various gadget options and even prioritize them for top-loading if necessary.

For more advanced server-side tasks, refer to the developing with ResourceLoader documentation page. This resource provides guidance on media queries and optimal methods for top-loading content.

Answer №2

I successfully managed to resolve this issue by organizing everything in main.css in a systematic manner. I appreciate the suggestions, but rest assured that I have successfully overcome this problem. By altering @media screen to @media and positioning it at the end of the CSS file, I was able to achieve the desired outcome.

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

How come my picture is clinging to the bottom of the container?

I am facing an issue where my "vertical rule" is sticking to the bottom of the container when placed to the right of the image. <div> <div style="display:inline-block; width:210px;"> <img src="res/img/PlayBtn.png" style="top:- ...

Including a drop-down arrow or triangle next to the initial button

In the navigation bar displayed below https://codepen.io/shaswat/pen/XzpRXL Is it possible to create a down triangle or arrow next to the "home" link, which changes direction upward when hovered over? How can this be achieved without modifying any HTML e ...

Running a CSS keyframes animation can be achieved by removing the class associated with it

Is there a way to reverse the CSS animation when a class is removed? I'm trying to achieve this on my simple example here: https://codepen.io/MichaelRydl/pen/MWPvxex - How can I make the animation play in reverse when clicking the button that removes ...

Disappearing text with HTML Bookmark and CSS Overflow:Hidden - What's happening?

Within the header of my webpage, there is an image div that has been styled with overflow:hidden. Inside the content section, I have a bookmark anchor tag: <a name="arghargh"></a> Located at the top of the content area, there is a link that ...

The autoscroll feature of an overflow element does not persist when additional elements are added

I am in the process of trying to automatically scroll an element to the bottom of a overflow:auto div whenever a new message is added to a list through jquery using .append Initially, I managed to accomplish this with: $(".content-wrapper").scrollTop($(" ...

Ensure that newly added elements are aligned with the settings of the slide's

I've encountered an issue with my jQuery slider that affects a div's CSS on slide. Everything works as expected, except when I add a new div, the settings from the slider aren't applied to the new div until the slider is moved again. HTML ...

I implement a Bootstrap navbar on my website, and when I scroll up, the content blocks seamlessly appear behind the fixed navbar at the top of the page

When scrolling up with my Bootstrap navbar, the block content appears behind the fixed top navbar. My Navbar code is as follows: <main id="navfix" class="m-5"> <nav class="navabar_bgc py-0 navbar navbar-expand navbar-l ...

How can I ensure that Bootstrap Navbar elements are all aligned in a single line?

https://i.sstatic.net/pkxyI.pngI'm experiencing an issue with my code, and I suspect it might be related to Bootstrap. I've tried using align-items-center but it doesn't seem to work as expected. Changing the display property to inline or in ...

Distribute divs of equal width evenly within a grid

I'm facing a unique challenge at the moment. I'm attempting to create a grid system where all elements have a fixed width of 200px each. What I envision is a clever grid setup using only CSS, where each "row" will strive to accommodate as many el ...

HTML/CSS: There is a sentence that has no spaces that is exiting outside a div

HTML: <div> bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb </div> CSS: div { width: 150px; border: 1px solid blue } DEMO: http://example.com QUESTION: How can we solve this issue? ...

There appears to be a malfunction with WebRupee

I have incorporated the new rupee sign into my website to represent Indian currency. Below is the code snippet I used: For the script, I included " and also added the following: <span class="WebRupee">Rs.</span> 116,754.00 To style it using ...

Add at the beginning of each row in the text area

I have a small text area on my webpage where I want to add ">>" to the beginning of each line. My initial attempt was to use this code: $("#mytextarea").prepend("EvilHacker001>>"); Unfortunately, this did not produce the desired result. I se ...

Why is my CSS causing a div with 100% width to be slightly taller than expected?

I am working on a website that I want to adjust to the width of different browsers. Everything seems to be functioning properly, except for the fact that the parent div containing the 100% width divs always appears around 5 pixels too tall. This is causin ...

How can I enhance Parallax scrolling performance on Chrome?

I recently completed a tutorial from the following link: After customizing it by changing the image to something different than clouds, I noticed that my version of the website was experiencing lag issues in Chrome but worked fine in Firefox. However, whe ...

How can one transform a web-based application into a seamless full-screen desktop experience on a Mac?

"Which software can be utilized to enable a web application to display an icon on the desktop of a Mac computer, while also opening up the web application in a fully immersive full-screen mode that supports all the touch and gesture functionalities provi ...

Issue with FlexSlider 2 and thumbnail slider: Previous and Next buttons not functioning for main image

I have encountered an issue while using FlexSlider 2 with the thumbnail slider. The problem is that the main image does not respond as expected. When I try to navigate using the next/prev buttons, it does not slide or fade to the next/prev image. Even cl ...

Select the M3 element in a ul using CSS targeting

I am working with a ul containing some li elements, here is an example: <ul class="M199 WIDTHBOX1 5ColumnBox"> <li class="M2"> <a class="M2" href="about-1561.aspx" target="">About</a> <div class="WIDTHBOX2" s ...

Why is the image not disappearing even after using JavaScript to do so?

I'm having an issue with my JavaScript code that is supposed to make an image disappear when the data-slide-to attribute is equal to 1. However, the image remains visible even though the code seems correct. Can anyone help me understand why it's ...

Conceal the vacant area located at the top of the page

By clicking on the "Run code Snippet" button or visiting this link, you may notice a significant amount of empty space at the beginning of the page. The images only become visible once you start scrolling down. I am looking for a solution to hide this emp ...

Achieve full width navigation without compromising the website layout

Is there a way to make my navigation menu fill the entire page? I tried using absolute positioning and setting the top, left, bottom, and right values to 0, but it ended up overlapping the content and changing the page color. Here's the HTML/CSS code ...