CSS keyframe animations causing media query to malfunction

Wondering why my animation keyframes placed above the media query in a Magento page seem to break the formatting. However, when I rearrange them, everything works perfectly.

Could it be a closing keyframes issue? Can't seem to locate any mistakes, so is this an error on my end or a common problem?

Here's the bottom part of my CSS:

    .shop:hover .imagesub {
    transition: 1s;
    max-height:80px;
}

.tooltip img:hover {
-webkit-animation: 0.5s linear 0s infinite alternate bounce;
     -moz-animation: 0.5s linear 0s infinite alternate bounce;
       -o-animation: 0.5s linear 0s infinite alternate bounce;
          animation: 0.5s linear 0s infinite alternate bounce;
}


@media only screen and (max-width: 1000px) { 
    .infobar {
        background-color: aqua;
    }
    .lefthalf {
        width:100%;
      }
    .righthalf {
        width:100%;
        float:left;
        }
    .shoprow {
        width:100%;
        height:auto;
        }
    .shop {
        width:99%;
        float:left;
        margin-bottom:14px;
    }
    .shop img {
        width:100%;
        height:auto;
        }
    .shopcontainer {
        height:auto;
        }
    .imagetitle {
        left:0px;
        width:100%; }
    .imagesub {
        display:none;
        }
}

@-webkit-keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px; height:45px; margin-left:-1px;}  }
   @-moz-keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px; height:45px; margin-left:-1px;}  }
     @-o-keyframes bounce { width:30px; height:40px; margin-left:0; } to { width:35px; height:45px; margin-left:-1px;}  }
        @keyframes bounce { width:30px; height:40px; margin-left:0; } to { width:35px; height:45px; margin-left:-1px;}  }

Functionality is intact. However, placing the keyframes above the media query disrupts its operation. Curious as to why this occurs.

Answer №1

It appears that there was an error in the code you pasted

Please take note that the last 2 CSS rules are missing from {

@-webkit-keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px.
        @keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px; }

You should correct it as follows:

@-webkit-keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px.
        @keyframes bounce { from { width:30px; height:40px; margin-left:0; } to { width:35px; }

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

Why won't one of the tables stay centered like the other one?

Struggling to organize my portfolio. My photos are in tables, centered with CSS. But when I added a new table with a header and new photo, it's not centered properly. It centers only when the tab is minimized but not at full size. How do I fix this? H ...

When using Django to add static CSS in HTML, the styles may not be visible on the

index.html includes {% load static %} at the top and {% static 'css/main.css' %} in the css link href {% load static %} <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <me ...

Move the scroll bar outside of the div and set it to automatically overflow

My issue involves a small div with the CSS property overflow:auto;. However, when the scroll bar appears, it covers up a significant portion of the div. One possible solution is to use overflow:scroll;, but this can result in an unsightly faded scroll bar ...

Why is it possible to apply column width to a div element, but not to a button?

This code functions properly and sets the button to a size 4: <div class="col-xs-4"> <button class="btn btn-block btn-primary">Like</button> </div> However, the following code does not work as expected: <div> <bu ...

Assigning IDs to jQuery tabs

My view contains something similar to this: <li><a href="SearchQC.do?mode=view">Add to QC List</a></li> While running, jQuery automatically generates a div with the id ui-tabs-1. How can I modify this ID? UPDATE If the ID remain ...

What is the best way to create a Material toolbar that changes from transparent to opaque when scrolling?

I'm in the process of familiarizing myself with Angular. I have incorporated Angular Material and I am trying to achieve a sticky and opaque material toolbar that becomes transparent with visible text when scrolling at the top of the page. Most soluti ...

Echo result triggers a color change in the table cell

Working on a piece of code that should change the background color of the first td element based on ping results. If success, it becomes green; if failed, it turns red. The issue I'm facing is that while I can display images or use different methods ...

Is there a way to automatically increase the width of a textarea?

Is there a way to automatically adjust the width of a textarea? I know how to make it grow in height, but I haven't come across a method to only increase the width. To provide a visual example, I'm looking for something similar to how iMessage e ...

Simplified JavaScript code for generating concealed input forms

Seeking assistance to enhance the form I designed, despite my limited knowledge in JavaScript programming. The objective is to develop a hotel search engine with the ability to specify the total number of rooms. Based on the selected number of rooms, addi ...

Having Trouble with the Bootstrap Responsive Menu Button Not Working

I'm struggling with the Bootstrap menu I created, as it's not collapsing or animating. Everything seems to be working fine except for the button that isn't functioning. <nav class="navbar navbar-expand-lg navbar-light bg-dark alb ...

Cannot hide the minimize/maximize button row in split pane editor layout on Eclipse Neon

Exploring the new features of Eclipse Neon has been a pleasant surprise. One notable improvement is the ability to reclaim wasted space from the UI with minimal effort. For instance, Gtk 3.20 (on Linux) has optimized scrollbars and gutters so well that cu ...

I'm having trouble getting my CSS and HTML to connect properly, and I'm not sure what the issue is

Hi there, I'm having some trouble with my HTML code. I haven't even started building my website because I can't seem to connect it to the CSS file, and I have no idea why. I'm using Aptana Studio 3 by the way. <head> <titl ...

When the page height is altered in real-time, it prompts a scroll event

When a slider on the page automatically switches slides and changes its height, it causes a scroll event to trigger unexpectedly. I want to modify the scroll event so that it only activates when the user physically interacts with the page by scrolling, r ...

Tips for designing a unique custom scrollbar

I'm in need of some CSS expertise to help me create a custom scroll bar that resembles the one shown in the image. The key requirement is for the background to be transparent, although I've temporarily positioned it against a green backdrop. ...

Excessive content spilling over the div container

Hello everyone I've been trying to set up a div that includes an image, a title, and some text. I want the image to be aligned on the left side, with the title and text following on the right. However, I'm having an issue where the text is overf ...

Text disappears from navbar after selecting anchor link

Recently, I've been experimenting with Twitter Bootstrap and have found it to be quite delightful. I managed to create a fixed navbar that sits at the top of my website. Inside this navbar, you'll find my logo, a header, a few links, and a dropd ...

What is preventing my Javascript from animating this text to change colors?

Having some trouble getting this color change animation to work on a successful result. I was experimenting with animations for the first time and can't quite pinpoint why it's not functioning as expected. Appreciate any help you can offer! HTML ...

What is the best way to add randomness to the background colors of mapped elements?

I am looking for a way to randomly change the background color of each element However, when I try to implement it in the code below, the background color ends up being transparent: { modules.map((module, index) => ( <div className='carou ...

What is the best way to maintain the layout design when resizing the font?

Here is the HTML and CSS code snippet: .navi ul li { float:left; list-style-type: none; border-right: 1px solid #c0c0c0; margin:0px 0 0 0; } .navi ul li:last-child { border:none; } .navi ul li a { display:block; margin:0 20px; text-dec ...

Sliding into a New Page with jQuery Mobile's Transition Effects

Whenever I transition between pages using a slide effect, the new page resizes before the transition from the previous page is complete. This makes the application appear glitchy. Is there a way to prevent this automatic resizing or auto height calculatio ...