When trying to rotate CSS elements, the @media query does not revert back to its original state

I've been struggling for a week trying to figure out why my media query isn't working properly. Even after all that time, the image still won't rotate when the screen size hits 1028 pixels.

The image is set on a red background of my website and I want it to change without rotation when it reaches 1028px. I followed the advice from the source below and used @media query to rotate with 0 degrees. It seemed like the right approach, but no matter what input I provide, the image doesn't respond. The @media query should be applying and the image should be rotating, but instead, when I minimize the screen to 1028 px, the image just moves from one container to another, which I find completely absurd!

I'm hoping someone can offer some guidance, and to help explain the issue, I've included screenshots:

https://i.sstatic.net/8wBsZ.png

https://i.sstatic.net/DyO0o.png

/* title-image */
.title-image{
  width:60%;
  -ms-transform: rotate(25deg); /* IE 9 */
  -moz-transform:rotate(25deg);
  -webkit-transform:rotate (25deg);
  transform: rotate(25deg);
  position: absolute;
  right: 30%;

}

@media (max-width: 1028px){
  .title-image:{
    position: static;
    transform: rotate(0);

      }
}

Answer №1

.main-image {
    position: static;
     transform: rotate(0);
       }

Answer №2

Hey there! Looks like we're both enrolled in the same full stack web development course on Udemy, right?

I encountered a similar issue with my phone not rotating back properly. What I did was keep the rotation at 0 until the screen size exceeded 1028px.

   .iphonedog
    {
      width: 300px;
      margin-left: 100px;
      
      position: relative;
      top: 10%;
      left: 50px;
    
    }
@media (min-width: 1028px)
{
  .iphonedog
  {
    position: static;
    transform: rotate(25deg);
    
  }
  
}

Following this workaround fixed the problem for me!

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

Incorporate a Background Image, which is linked to a website URL, by utilizing an external CSS file within

I am struggling to incorporate an external CSS file (specifically a background image from a URL) into my HTML document. I have successfully applied internal CSS, so the issue is not with the website link. Despite reviewing similar posts addressing comparab ...

Safari Version 8.0.2 experiencing issues with fixed positioning

I am currently working on an angular application and I find myself inside a Twitter Bootstrap modal. My goal is to relocate a button that is located within the body of the modal to the footer of the modal using fixed positioning. This particular button tr ...

Can the floated DIVs be prevented from breaking onto a new line if they exceed the container's width?

Take a look at this sample HTML code: <div id="container" style=""> <div id="left" style="float: left; width: 200px;">...</div> <div id="right" style="float: right; width: 100px;">...</div> </div> How can we prevent ...

Creating a customized file input using CSS

I am currently utilizing Bootstrap4 to craft my webpage and I am incorporating a custom file input bar. To retrieve the three labels of the input bar ("Choose file", "Browse", "Upload") from my stylesheet, I have created three custom classes with their co ...

Change to a different button based on a condition in ReactJS

Currently, I am tackling a ReactJS project that involves the utilization of the following function: function checkMoves() { let index = 0; let moveList = []; while (index < props.moves.length) { if (!moveList.includes ...

Develop a circular carousel using React JS from scratch, without relying on any third-party library

I am looking to replicate the carousel feature seen on this website. I want to mimic the same functionality without relying on any external libraries. I have found several resources explaining how to achieve this. Most suggest creating duplicate copies o ...

The default appearance of bootstrap-select appears to be flawed

Utilizing the amazing Bootstrap-select jQuery plugin has brought two unexpected default styles to my selectboxes. Despite inserting the necessary CSS and JS files into my website, all select boxes are displaying with these peculiar default settings (withou ...

I successfully created a Chinese writing practice deck in Anki, which is functional on the desktop version but unfortunately not compatible with Ankidroid

While AnkiDesktop is functioning properly, there seems to be an issue with character encoding in Ankidroid. Despite trying numerous solutions, the problem persists. The character length displays correctly in Anki Desktop, but not in Ankidroid. For example ...

Is there a way to automatically determine the text direction based on the language in the input text?

When posting in Google Plus (and other platforms), I noticed that when I type in Persian, which is a right-to-left language, the text direction changes automatically to rtl and text-alignment:right. However, when I switch to English, the direction switches ...

The scrolling content is positioned beneath the primary header and navigation bar

I'm currently in the process of designing a website where, upon clicking a navigation button, part of the page scrolls while the top header & nav bar remain fixed. Although I've managed to get the scrolling functionality to work and keep the top ...

Fading CSS Hover Popup Display and Hide

I am looking to create a CSS-only popup for an image that will appear when a user hovers over the image with their mouse. After researching on various platforms, such as this thread, I have developed the following solution: a.tooltip span { width: 250 ...

Do we really need jquery.min.js in addition to bootstrap-4.0.0-alpha.6?

Recently, I've been experimenting with Bootstrap 4.0.0-alpha.6 by downloading the 'source' files. In some of the example themes located in 'bootstrap-4.0.0-alpha.6\bootstrap-4.0.0-alpha.6\docs\examples', such as nav ...

- Determine if a div element is already using the Tooltipster plugin

I have been using the Tooltipster plugin from . Is there a way to check if a HTML element already has Tooltipster initialized? I ask because sometimes I need to update the text of the tooltip. To do this, I have to destroy the Tooltipster, change the tit ...

"Safari browser may hide placeholder text, making it invisible to viewers

When adding color to the placeholder, I utilize this CSS property: .pro_heading input::-webkit-input-placeholder { color: #777; } However, it appears that in Safari, the color is not visible. https://i.sstatic.net/hXmjX.jpg ...

The Tabbed Panel Bug: Incorrect HTML ID Causing Tab Change Issues in Bootstrap

I've been working on a tabbed panel feature for my website. However, I've run into an issue where clicking on the second, third, and other tabs doesn't change the content displayed - it always stays the same. I'm pretty sure I wrote th ...

Choose all the items that share a specific hue?

How can I target all elements with a specific color? I need to update all text that has a color of #1a0dab to #00b0f4. ...

Is it possible to use CSS to swap out main menu items for submenu items?

I have created a basic vertical menu that looks like this: Home Information Info I am wondering if it is possible to replace a list item with its own sublist when the item is active. Specifically, I want to change Home to Sub1 and Sub2 when the item is ...

Is it possible for URLs in CSS Custom Properties to be relative to the CSS file where they are defined?

I have a CSS library with resources like images and fonts that can be accessed from anywhere via CDN. I am trying to create URLs for these resources as Custom CSS Properties, relative to the library. <!-- https://my.server/index.html --> <link rel ...

What causes jQuery to not work correctly during keydown events?

I've been working on this external jQuery code: jQuery(document).one('keydown', 'g',function (evt){ if ($("#tb").html() == "0") { $("#tb").html("Testing the chicken.") } else {$("#tb").html("Chickens fart too." ...

What is the best way to apply the active class just once?

I am having an issue with my v-for loop in Vue.js where the bootstrap 4 .active class is repeating. I only want the bootstrap 4 active class to repeat once. Can anyone suggest a solution to this problem? var app = new Vue ({ el: '#app', d ...