Desktop media query taking precedence over all screen sizes

Incorporating a mobile-first approach to media queries, I have implemented min-width settings at 37.5em and 50em for tablets and desktops.

I want the project section to be displayed as a column on mobile devices and as a row on desktops, but it seems like the desktop media query is taking precedence over everything else.

Here's the HTML code:

<section id="projects">

<h2>Projects</h2>

<div id="projects_container">

<figure class="hvr-float-shadow">
    <img src="ImagePlaceholder.png">
    <figcaption>Random Quote <br> Generator</figcaption>
</figure>

<figure>
    <img src="ImagePlaceholder.png">
    <figcaption>Random Quote <br> Generator</figcaption>
</figure>

... more figure elements here ...

<figure>
    <img src="ImagePlaceholder.png">
    <figcaption>Random Quote <br> Generator</figcaption>
</figure>


 </section>

For the mobile-first CSS:

#projects{
padding-top: 5rem;
padding-bottom: 15rem;
background-color: #FFFAFA;
flex-direction: column;
justify-content: center;
margin: 0 auto;
display: flex;

}


 #projects_container{
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
flex-wrap: wrap;


}

 figure{
 display: block; 
 position: relative; 
 overflow: hidden; 
 width: 75%;
 }

 figure img {
width: 100%;
}

... additional styling rules ...

The problematic desktop media query:

@media (min-width: 50em) {
#projects_container {
    flex-direction: row;
    font-size: 145%;
    align-items: center;

}
#unhide-text {
display: inline;
}

... additional styling for desktop devices ...

}

I believe that the media query should only take effect if the conditions are met.

What am I missing?

Answer №1

Substitute em with px. Also, verify the breakpoints for tablets and mobiles.

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

Issues with vertical repeating in CSS Sprites

Hey there, I'm currently working on implementing css sprites in my web application. The challenge I'm facing is that I have organized the background of my website vertically within a sprite image. Now, one specific portion of the sprite needs to ...

Difficulty arises with z-index when hover effects are applied to clip-path shapes

I'm encountering an issue where I am attempting to make two clip path polygons overlap each other when hovered over by the mouse. I have been using z-index values and trying to adjust them based on which overlay is being hovered over, but unfortunatel ...

Creating a centered floating card within a div that shrinks to fit its contents: A CSS how-to guide

I am facing a challenge with positioning a floating card that needs to be centered over the parent div (which happens to be selectable because it's a map). So far, I have only managed to achieve this by setting a fixed width for the card using the fo ...

Enhancing font display in Chrome

Encountering issues with font rendering in Chrome. The screenshot highlights a discrepancy in color for the first item in a list: https://i.sstatic.net/dUadd.png Despite all items having identical CSS properties: https://i.sstatic.net/2ropj.png An app ...

Content within a Row of a Data Table

Hello! I am just starting to learn JavaScript and jQuery. Can you help me with an issue I am experiencing? Basically, I have a table and I need to identify which tr contains a td with the text "Weekly", "Daily", or "Monthly". Once I locate that specific t ...

The overlay only covers a portion of the page

I'm currently working on a new webpage and have found the perfect background image. However, I would like to add an overlay to darken the image. Unfortunately, the overlay doesn't cover the entire page! Despite my attempts, I haven't been s ...

What are some ways to add border styles to the Material UI TableRow Component?

In my project, I am utilizing the Table component from Material UI. I have been trying to apply border styles to the TableRow Component using scss classNames for styling purposes. Usually, the border styling is applied in the TableCell, but this doesn&apos ...

Achieving Content Alignment Using CSS

I successfully implemented a design on my HTML page that divides it into three sections vertically, with each section having a different background color - white, gray, and black. The backgrounds stretch the full width of the page regardless of screen reso ...

Issue with CSS File not being recognized by React Component

After using the webpack create-react-app with npx, I encountered an issue with my component styling. Despite having a CSS file named header.css in the src directory alongside Header.js, my component does not seem to be styled correctly. Here is how my comp ...

Eliminating the border around a textarea in HTML

Currently, I am dealing with the textarea tag in HTML and am trying to eliminate the border surrounding the box. Additionally, I am aiming to position the text at the bottom of the textarea. ...

Displaying image issues persist on Safari browsers for Mac and iPhone

I am currently working on a website and facing an issue with the responsive image display on Safari for Mac/iPhone. Here is the code snippet I have been using: <head> <meta charset="utf-8"> <meta http-equiv="Content-Language" co ...

The Challenge of Styling Scrollbars with CSS

.body_c { scrollbar-face-color:#408bc4; scrollbar-shadow-color:#afefff; scrollbar-highlight-color:#afefff; scrollbar-3dlight-color:#000000; scrollbar-darkshadow-color:#006399; scrollbar-track-color:#bfd3e6; scrollbar-arrow-color:#FFFFFF; margin-top ...

Guide to choosing a class::-webkit- using JavaScript or jQuery

I am facing difficulty in selecting a CSS class named .slider::-webkit-slider-thumb to modify a property. Despite trying various options, JavaScript doesn't seem to be targeting it. document.addEventListener("DOMContentLoaded", function (event) { va ...

Create a typewriter effect that mimics the backspace feature by allowing overlapping characters

I am interested in creating a simulation for the vintage LGP-30 computer. This will involve input and output on a simulated Friden Flexowriter typewriter. One unique feature of the typewriter is that pressing the backspace key merely shifts the print head ...

Design a dynamic pagination button for my project that allows users to navigate between pages effortlessly

Can anyone assist me in creating next and previous buttons? I've been struggling with my JavaScript skills. I noticed that many people use jQuery or pure JavaScript for this. Since I'm still learning JavaScript, there are a lot of concepts I&apos ...

The "div width 100%" property functions flawlessly when tested locally, yet fails to operate on the live server

Hello, I recently launched my new website at www.leafletsdistributors.com. However, I'm encountering an issue with the Get in touch section (the light grey colored area). Despite setting the width to 100%, it's not fully extending across the scre ...

Why isn't this basic CSS animation executing properly?

I have encountered an issue and I have created a JSFiddle to demonstrate it. http://jsfiddle.net/sqMT6/1/ Basically, when you click on a paragraph, the 'hidden' class is supposed to be set, triggering a webkit animation that makes the paragraph ...

Issues with CSS not being effective on an HTML webpage

Within my spring project, I am utilizing XsltViewResolver to transform XML into HTML using org.springframework.web.servlet.view.xslt.XsltViewResolver. The issue I am facing is that the CSS styling is not being applied in the HTML output. Here is a snipp ...

Glitch with menu presentation in Safari browser

I'm currently working on a website for a client who specifically wants a traditional, non-responsive design. The site has been successful over time, but I've encountered an issue with the menu display in Safari. While it looks fine on other brows ...

Drupal 7 FlexSlider - alignment issue with image placement

I am encountering an issue with the Flexslider module on my Drupal 7 website. I have created a simple slider that displays 3 photos. I enabled touch screen functionality for the slider, and everything seems to be working fine except for one problem - all t ...