Why do child elements of a collapsing parent div not collapse with it in CSS transitions?

Just diving into the world of css transitions and experimenting with collapsing a fixed popover div using CSS transition. I managed to collapse the outer div successfully, but the elements inside it did not collapse along. Is this the expected behavior? Any suggestions on how I can completely collapse the "Helpful?" popover? Check out the Plunker demo here: http://plnkr.co/edit/FYbeIe7IY41Ik3LBcf1r?p=preview

Answer №1

To ensure the fixed element does not overflow, simply add the CSS property overflow: hidden.

Here is an example:

.feedback-popover {
    position: fixed;
    width: 50%;
    overflow: hidden;
    border: 1px solid;
    right: 32px;
    background-color: #dcdcdc;
    z-index: 1030;
    top: 66px;
    max-height: 350px;
    -webkit-transition: max-height 0.5s ease-in-out;
    -moz-transition: max-height 0.5s ease-in-out;
    -o-transition: max-height 0.5s ease-in-out;
    transition: max-height 0.5s ease-in-out;
}

.feedback-popover-collapse {
    position: fixed;
    overflow: hidden;
    width: 50%;
    right: 32px;
    background-color: #dcdcdc;
    z-index: 1030;
    top: 66px;
    max-height: 0px;
    -webkit-transition: max-height 0.5s ease-in-out;
    -moz-transition: max-height 0.5s ease-in-out;
    -o-transition: max-height 0.5s ease-in-out;
    transition: max-height 0.5s ease-in-out;
    }

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

Modifying an image in a particular row of a table generated using the *ngFor loop in Angular

Currently, I am working on a table generated by ngFor. Each row in the table contains a button with an image as its background: <tbody> <tr *ngFor='let movie of movies let i = index'> <td>...some values here. ...

Angular animation will be triggered when the user clicks using ng-click

In my Angular project, I'm looking to implement an animation that will enlarge the size of an image. Below is the code snippet: <div class="card"> <div class="item images-parent"> <img src="img/carryout-icon.jpg" class="left-image" ...

What is the best way to confirm checkbox selection based on MySQL data?

Writing this question feels challenging, but I have a collection of checkboxes with their data stored as JSON in my PHP database. What I'm trying to achieve now is to dynamically load the JSON data on the page without refreshing it, checking specific ...

Animated mosaic pattern menu design

Is there a way to achieve this effect with a sketch? Note: I would like to add hover animation to the borders if possible. I attempted to do it using the following code: clip-path: polygon(0 0, 100% 0, 92% 86%, 6% 100%); However, the shapes created by ...

What could be causing the combined width of the children to exceed that of the parent?

Encountered an issue while trying to create a horizontal scroll using inline-flex. Unable to add padding around the scrolling div due to inconsistencies in child widths causing unexpected behavior. To further investigate and understand the problem, visit ...

Angular - Dividing Functionality into Multiple Modules

I am currently working with two separate modules that have completely different designs. To integrate these modules, I decided to create a new module called "accounts". However, when I include the line import { AppComponent as Account_AppComponent} from &a ...

Implementing dynamic title insertion into a popover element using jQuery

My goal is to assign a title to my popover object in a local project. I have already included the following files: bootstrap.css v4.2.1 jquery.min.js v2.2.0 bootstrap.min.js v4.2.1 popper.min.js v1.11.0 Initially, there was a basic button present. <i ...

What are the steps to create a login form that is responsive by utilizing the Bootstrap grid system

.custom-border { border: 2px groove #000 !important; padding: 0px 5.4em 1.4em 6.4em !important; margin: 0 0 1.5em 0 !important; box-shadow: 0px 0px 0px 0px #000; margin-top: 30px !important; } .custom-legend { font-size: 1.2em !important; te ...

How can I execute a function when ng-click is triggered on an <a> tag, and ensure it opens in a new tab?

I am facing an issue with an element in my code, which is as follows: <a ng-click="vm.openPage(page)">{{page.pageId}}</a> Within the vm.openPage() function, there are validations that need to be performed before redirecting to the page refere ...

Error encountered: Java NullPointerException in Applet

When attempting to embed an applet into an HTML file for a university class demonstration, I consistently encounter a NullPointerException dialog upon execution. What could be causing this issue? <html> <head> <title> My Pacman Gam ...

Solid colored fill for the active item in the Bootstrap navbar

As I work on constructing a web page using Bootstrap 5 with a fixed top navbar, I am aiming to have the "active" item highlighted with a solid background color similar to the example shown here. Upon inspecting the page using developer tools, I noticed th ...

Ways to fetch additional Product Cards using JSON and a nextPage parameter

I'm facing difficulties in nesting a fetch inside another fetch. I'm not sure if this is the correct approach, but my goal is to utilize Vanilla JavaScript to fetch another JSON from the nextPage URL within the JSON list when the "load more" butt ...

The application of knockoutjs bindings is restricted to specific ids and cannot be used on any

In my project, I have multiple views where each one applies bindings to its own tag individually. Here is a snippet of the code: (Please note that some code has been omitted for brevity. For a more complete example, you can view the full fiddle here: http ...

What is the best way to showcase information retrieved from an AJAX request onto a div using Jquery or Javascript?

When data is received in a HTML page through an AJAX call, it typically appears like this: <input type="hidden" id="s1" name="1" value="111" /> <input type="hidden" id="s2" name="2" value="222" /> The data then loads into <div="ajax"> A ...

What are the buttons featured in the header of this mobile-friendly bootstrap panel

Can anyone offer advice on how to make a bootstrap panel header responsive? The panel has a title with several buttons on the right side. While it looks good on a large screen, it becomes messy on smaller browser sizes. You can find my complete code here ...

The Next.js application is unable to load the combined CSS from a React Component Toolkit

My React components repository includes individual .css files for each component which are imported into the respective components. These components are then bundled using a rollup configuration and published as an NPM package, with all component CSS being ...

What is the best way to make sure the background image adjusts to fit the browser window as it is resized?

Currently, I am working on creating a small responsive webpage that features a background image with several buttons placed on top of it. To set the background image, I included the following CSS: .background { height: 100vh; width: 100%; backg ...

It is important for the CSS :active state to transition to an "inactive" state after a certain period of

For mobile, I utilized the :hover and :active pseudo-classes to create a transition effect when tapping on a tab that enlarges the elements for more information. However, I am seeking a way for the activated element to return to its original state after a ...

What is the best method for removing extra spaces from an input field with type "text"?

I have an input field of type "text" and a button that displays the user's input. However, if there are extra spaces in the input, they will also be displayed. How can I remove these extra spaces from the input value? var nameInput = $('#name ...

CSS box spacing is the key factor in creating clear layouts and

Having these 3 boxes is causing some spacing issues that I need to address. Whenever I try to add margin, the third box shifts to the next row. Below is the snippet of code: CSS: #hotels { background: url('../img/PICS/19427110_ml.jpg'); ...