Chrome is giving me trouble with the @media screen feature for min-width of 1200px

Having an issue with the @media screen (min-width:1200px).

I've defined 2 classes in the CSS to make an image and the corresponding "td" element smaller when the screen is resized. However, even when the screen width exceeds 1200px, the image remains small.

This is the HTML snippet:

 <tr>
     <td class="indexphototd">
         <img class="indexphoto" src="../wp-content/uploads/2013/05/indexphoto300.jpg" /></td>
     <td>more stuff here</td> 
 </tr>

This is the CSS code:

/* for browsers larger than 1200px width */
@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}


@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}

Answer №1

Your media queries are conflicting: 1200px is still considered as 800px or larger in your code. Consider reversing the order of your media queries.

@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}

@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}

Answer №2

In the scenario where a screen width is 1400px, the 800px setting will be applicable in your current configuration. To adjust this, simply swap their positions as outlined below:

@media screen (min-width: 800px) {
     .indexphototd {
            width:200px !important;
        }
     .indexphoto {
         width:200px !important;
      }
}
@media screen (min-width: 1200px) {
     .indexphototd { 
            width:300px !important;
        }
     .indexphoto {
         width:300px !important;
      }
}

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

The left side of the page is anchored with text content while an engaging carousel occupies the right half

Looking to create a section on the website that remains fixed while a carousel scrolls vertically. Once you reach the final slide, scrolling will continue on the page rather than changing the carousel slide. Want it to function similarly to the Creative s ...

What could be causing the issue with my code attempting to conceal a parent div?

I attempted to follow the guidance found here, tweaking it to suit my requirements, but unfortunately, it's not producing the desired result. I am endeavoring to conceal a parent div that contains two child elements. These parent divs are part of a li ...

Arranging my HTML text fields for optimal organization

I am struggling to format my text fields the way I envision. Here's what I want: - Username field at the top - First and last name underneath each other - Password and confirm password next to each other below names As a newcomer to HTML, I'm fi ...

What is the method for inserting line breaks in Django at particular characters?

How can I add line breaks after specific characters in my text? Check out this image: https://i.sstatic.net/bz1h1.png I need to insert line breaks after every 50 characters in the text shown in the image. Take a look at my HTML FILE: {% extends ' ...

Increase the Bootstrap rowspan and eliminate any excess spacing between rows in order to improve

I need help adding a container to my form that is approximately 4 bootstrap rows high. The issue I am facing is when I place the container in the second column of the first row, there is unwanted white space appearing under the first column of the same row ...

Generating PDFs from websites using code

Currently, I have my resume available online as an HTML page at www.mysite.com/resume.html. Whenever I need a PDF version of it, I rely on Google Chrome's print dialog to save it as a PDF using my print CSS stylesheet. However, I am looking for a way ...

Looking for some assistance with an auto-calculation form, anyone able to help out

Is there anyone skilled in JavaScript here? I am looking for a form that includes the following fields which will automatically calculate and display the total amount as I input numbers into the fields. <input type="text" name="actualprice" value=""&g ...

Linking CSS3D objects in a three.js environment

In my current project, I am working on creating a navbar within the three.js environment. I have set up all the necessary CSS3D configurations and added a mouse down event listener. However, I am facing an issue with the intersects not displaying anything. ...

Modify the CSS of one div when hovering over a separate div

I've been working on a simple JavaScript drop-down menu, and it's been functioning correctly except for one issue. When I move the mouse out of the div that shows the drop-down menu, it loses its background color. I want the link to remain active ...

Replace the text in a different Div

Hello everyone, I'm struggling with an issue in my coding. Here is the HTML: <a href="aboutme.php"> <div class='aboutus'> <div id="mbubble"> stuff inside here </div> </div> ...

What is the best method for determining the height of a sandboxed iframe?

My website includes an iframe with the sandbox attribute. Users can set the content of this iframe directly through the 'srcdoc' attribute, which raises security concerns. I am trying to find a way to dynamically adjust the height of the iframe ...

When attempting to dynamically insert an option into a select element, an unexpected issue arises where a duplicate set of

I am attempting to create a dropdown multi-select menu within a table cell using vanilla JavaScript. During the process, I seem to have generated duplicate options which can be seen in the console when running the code. It appears that my current approach ...

How can I update the content of a span in Angular 2 by clicking a div, and then change the text above it when the span is filled?

As a newcomer to this community with basic English proficiency, I hope to communicate effectively. My journey into learning Angular 2 has led me to a specific question: I've set up a keyboard with four spans above it, each intended to hold a digit th ...

Django is encountering difficulties locating static files

Currently, I am developing a login page application. The desired layout for the login page can be accessed via the link provided below. This particular login page includes two images and aligns them using CSS along with other resources within Django. When ...

What is the best way to split two divs in this manner?

Is there a way to split two divs like this in such a manner using TailwindCSS? Alternatively, what would be the CSS code for dividing these two divs? I am struggling with this concept and cannot wrap my head around how it can possibly be achieved. ...

textarea element enclosed by a div tag

I'm looking to add two side-by-side boxes on my page for comments. One box will display previous comments and should be disabled, while the other allows current users to leave comments. I achieved this by using two separate divs positioned next to eac ...

Retrieving various data from the created panel

I've come across an issue with my logic that involves looping and adding a new Panel control to another control: for (int segmentIndex = 0; segmentIndex < segments.Length; ++segmentIndex) { holder.Controls.Add(new Panel() { Width = Unit.Percen ...

Unexpected outcomes in SharePoint REST API queries when using $top and $skip parameters

Having an issue with the SharePoint REST API where my query keeps returning the same XML response, regardless of using the $top and $skip parameters. Here are the two queries I've been experimenting with: Initial query: Query with paging: Despite i ...

Position a div off-center using CSS styling

Currently, I am utilizing a flexbox to center a div inside another div, akin to a dialog window that pops up at the center of the screen when required. The functionality is sound, but aesthetically it would be more pleasing if the space above and below th ...

Achieving multiple rows in a single cell using the GridView control can be accomplished by custom

I have a task at hand where I need to display a list of profiles related to each user in a single cell with multiple rows within my gridview. How can I achieve this? This is what I have attempted: <asp:BoundField DataField="UserName" HeaderText ...