Animating a div's height with CSS keyframes, moving it smoothly from bottom to top

I am working on animating a grey bar from top to bottom, but now I need it to animate from bottom to top instead. You can view my current code here: http://jsfiddle.net/hrcu9e6b/3/

<div class="review-type-wrapper-v">
    <div class="review-type-inner"  style="height:82%">
        <div></div>
    </div>
</div>

@-webkit-keyframes lineV {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

@keyframes lineV {
    from {
        height: 0;
    }
    to {
        height: 100%;
    }
}

.review-type-wrapper-v,
.review-type-wrapper-h{
    border-radius:3px;
    border:1px solid $rating-background-dark;
    overflow: hidden;
    .review-type-inner{
        position: absolute;
        > div{
            background-color: $rating-background-dark;
            //position: absolute;
            left: 0;
            height: 100%;
            //width:100%;
        } 
    }
}


.review-type-wrapper-v{
    position: relative;
    width: 14px;
    height: 60px;
    .review-type-inner{
        bottom: 0;
        width: 100%;
        height: 100%;
        > div{
            -webkit-animation: lineV 3s linear;
            animation: lineV 3s linear;
        }
    }
}

Answer №1

If you want to achieve this effect, you can utilize a CSS3 2D transform. It's worth noting that this feature is only supported in IE 10 and above. However, considering you are using key-frames, you probably aren't too concerned about compatibility with older versions of IE.

    @-webkit-keyframes lineV {
        from {
            height: 0;
        }
        to {
            height: 100%;
        }
    }
    @keyframes lineV {
        from {
            height: 0;
        }
        to {
            height: 100%;
        }
    }
    .review-type-wrapper-v, .review-type-wrapper-h {
        border-radius:3px;
        border:1px solid #333;
        overflow: hidden;
    }
    .review-type-inner {
        position: absolute;
    }
    .review-type-inner > div {
        background-color: #333;
        //position: absolute;
        left: 0;
        height: 100%;
        //width:100%;
    }
    .review-type-wrapper-v {
        position: relative;
        width: 14px;
        height: 60px;
    }
    .review-type-inner {
        bottom: 0;
        width: 100%;
        height: 100%;
    -webkit-transform: rotate(180deg); /* Safari */
    transform: rotate(180deg);
    }
    .review-type-inner > div {
        -webkit-animation: lineV 3s linear;
        animation: lineV 3s linear;
    }
<div class="review-type-wrapper-v">
    <div class="review-type-inner" style="height:82%">
        <div></div>
    </div>
</div>

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

Sticky element on the left side vanishes while scrolling towards the right

My goal is to design a webpage with five distinct regions, out of which three are meant to be sticky. However, while implementing this feature, I encountered an issue - when the user scrolls to the right beyond the viewport width, the left sticky elements ...

Display a picture from a directory onto a webpage by incorporating ASP.NET in C#

I am in the process of creating an image gallery for my website. In this scenario, I am displaying thumbnails of all images and when clicked, the image appears in a modal window. There are two main folders: Thumbs (contains thumbnails) Full Image (contai ...

Aligning a title and a subheading in a horizontal manner

I want to align my h3 headings with my h5, using Bootstrap, so they are on the same line. UPDATE: I aim to leverage existing Bootstrap functionality and avoid modifying CSS unless absolutely necessary. Here is a screenshot illustrating what I mean: https ...

The pseudo class before is experiencing issues with background color in Safari and not functioning as

Issue with Pseudo class before not displaying background colour in Safari browser To view the code, please visit the following link here HTML <div id='test'> <p>Test </p> </div> CSS #test { position: relative; per ...

"Embracing the power of dynamic CSS customization within Umbraco

I recently inherited an Umbraco system without much prior knowledge of the platform, and I am currently investigating the site's performance. The branding and styling of the site is currently managed through a "Brand" document type, allowing the site ...

Is there a way to align cards to stack on both the right and left sides of each other?

I need to create a card that includes text and an image, save it as a component, and then display this component three times in app.component.html so that the cards are all visible on the website. Currently, the cards are stacked vertically. How can I alig ...

Header on top of table that stays in place with scrolling

I'm facing an issue with a table that contains user-generated data. We are utilizing a plugin known as Clusterize, which allows us to smoothly scroll through large amounts of rows. However, the specific markup required for this plugin seems to be caus ...

Tips for fixing image distortion on screens smaller than 576px in a Bootstrap 5 responsive layout

view image description here see image details here <div class="banner"> </div> .banner { background-image: url(../img/portada.png); height: 20rem; /* Setting height because it is empt ...

Struggling to align a column within a container in HTML CSS, issues with CSS not functioning as expected

I have been attempting to vertically center the column within a container, but it keeps aligning to the left. Despite trying numerous CSS properties, I can't seem to get it right. Shrinking the width of the paragraph container to 650px or 70% doesn&ap ...

"My attempts to link various buttons in separate Bootstrap modals to their specific content are not yielding successful results

Greetings fellow members of Stack! Please bear with me as I am a newcomer here. I am currently working on a Business website for a friend using Bootstrap3. On our team page, we have multiple members and I would like to display additional details for each ...

Fuzzy Background to Enhance Your Bootstrap 5 Offcanvas Navigation Menu

Currently utilizing Bootstrap v5.2, I am endeavoring to replicate the image displayed in the link below: Blurry Sidebar Backdrop As per the MDN Documentation, backdrop-filter is intended for blurring the background of an element. .offcanvas-backdrop { ...

Customizing the field_error_proc in Rails is causing issues with the HTML layout

Within a rails application, I have customized the field_error_proc to enable inline error displays as shown below: https://i.sstatic.net/DjmdN.png The code snippet for achieving this functionality is outlined here: ActionView::Base.field_error_proc = pr ...

Is there a way to eliminate the directional tag from the base css by utilizing a separate css file?

css, body, forms { text-align: right; } I need to remove this part of the code because it is causing alignment issues with my slider in IE7. ...

How to smoothly fade out content when hovering over a menu item in HTML<li> tags

Hi there, I have encountered a problem and could really use your assistance. I am attempting to create a menu that displays content when you hover over an li tag. The first content should always be visible when hovering over the first li option or if no l ...

How to change the file name of an HTML page in a website template?

After downloading a free dashboard website template from the internet, I've been trying to incorporate it into my own website. My main focus now is on creating a navbar that opens the relevant page upon clicking. To do this, I duplicated the html fi ...

Is using tables still considered a recommended practice for organizing a layout such as the one shown in the [IMG]?

Looking for recommendations on arranging images in the footer, in line with the design mockup using HTML/CSS. Wondering if tables are still a viable option for this purpose? ...

How to precisely position a div within a table cell using Firefox

Currently, I am developing a script that replaces ads. At times, advertisements show up inside of <td> tags like the following: <tr> <td align="right" width="40%"><a><img src="ad.jpg"></a></td> <td>123&l ...

Deactivating form elements using jQuery

I am attempting to utilize jQuery in order to disable a form element once a checkbox is clicked, but for some reason it's not working properly. Can someone help me identify the issue? $('name="globallyAddTime"').click(function() { if ($ ...

What is causing the bootstrap nav-bar to not open on smaller screens?

This nav-bar functions properly on screens larger than 640px, but on smaller screens, the menu button does not display the menu items when clicked. You can view the site here. <nav class="navbar navbar-inverse"> <div class="container-fluid" ...

Changing the special characters in ASP.NET MVC

I'm facing an issue with c# and html code that involves special French characters : <html> <head> <link rel="stylesheet" href="~/Content/jquery.treeview.css" /> <script src="~/Content/jquery.cookie.js" type="text/javascri ...