The linear transition property in CSS is not being followed as expected

I'm trying to create a smooth linear transition on the height of a box with CSS, but it's not working as expected. Currently, the transition is abrupt - the height suddenly increases and then the margins take up all the time. Can someone provide me with a solution to fix this issue?

.resource .resource-item-list .resource-item{
    max-height: 0px;
    overflow: hidden;
    -webkit-transition: all 3s linear;
    transition: all 3s linear;
}

.resource .resource-item-list .resource-item.open{
    width: 100%;
    height: auto;
    max-height: 10000px;
    margin-bottom: 30px;
    margin-top: 20px;
    background-color: red
    overflow: hidden;
    display: block;

}

https://i.sstatic.net/EnJXq.gif

Answer №1

Yes, the functionality is there, although the transition goes abruptly from 0 to 10000px in size.

While the transition technically lasts for 3 seconds, only a small fraction of it is visible due to the container's height being so large (10000px). This means that most of the transition occurs within just 0.03 seconds.

Regrettably, achieving a seamless fixed-time transition with a dynamic height container using CSS alone seems unlikely.

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

Unlock the navigation tab content and smoothly glide through it in Bootstrap 4

Hey there, I have managed to create two functions that work as intended. While I have some understanding of programming, I lack a background in JavaScript or jQuery. The first function opens a specific tab in the navigation: <script> function homeTa ...

The effectiveness of Tailwind utility classes is exclusive to CSS files rather than inline code

My tech stack includes electron, react (web), typescript, and tailwind. Currently, I am encountering an issue where tailwind only applies styles in .css files but not inline. See the example below: In .css file (works) .navbar { @apply border-2 border ...

Customer is unable to locate the "InitializeAuthenticationService" function

After launching my application, the browser console keeps showing me three errors that all say Could not find 'AuthenticationService.init' ('AuthenticationService' was undefined). and Microsoft.JSInterop.JSException: Could not find &apo ...

How to execute a doPostBack function within a jQuery click event

My current situation involves a js function that triggers a click event on all 'a' elements... $(document).ready(function hideRanges() { $('a').click(function (event) { $('.ranges, #UpdatePanel').hide(); }); }); ...

Unnecessary scrollbar appears in the Simple Material UI dialog demonstration

My Material UI dialog consists of a grid with a scrollbar that allows scrolling even though the content fits on the screen. <Dialog open={isOpen} onClose={() => changeIsOpen(false)}> <DialogContent> <Grid containe ...

What is preventing hover from working correctly?

I'm having trouble getting images to display when hovering over text. Can anyone offer suggestions on what might be causing this issue? The images are being downloaded when clicked, so I know they're in the correct path. I've checked for com ...

The CSS infinite animation becomes erratic and sluggish after a short period of time

My website featured a banner with a series of thumbnail images that animated at different intervals and looped indefinitely. Initially, the animations ran smoothly, but after a few seconds, they began to slow down and lose consistency. To troubleshoot, I u ...

Display only the highest image in the picture carousel using Jquery

My goal is to create a simple image slider using HTML, CSS, and Jquery. However, when I try to move it left by 750px, only the topmost image moves and the rest of the images are not displayed. It seems like all the images are moving at once instead of jus ...

Can the "title" attribute of an <a> tag be modified using CSS?

Is it possible to change the value of "title" using CSS in my HTML code? I have tried different ways, but the following CSS code did not work. How can I resolve this issue? .icon { content: attr("A new title"); } <a class="icon" href="https://www. ...

Arrange the columns and rows in a neat layout for the ant design table

I have encountered an alignment issue with the ant design table while listing out my data. The columns are aligned to the right, but the titles for all columns should be aligned to the left by default. You can view the image illustrating this problem using ...

Utilizing Bootstrap 4 to integrate both collapsible and non-collapsible navigation elements

I am working with a bootstrap nav bar and trying to achieve a design where some menu items are collapsible while others remain visible at all times. Below is the code snippet I am using: <link rel="stylesheet" href="https://stackpath.bootstrapcdn.co ...

Encountering a problem with the CSS locator select-react

I'm encountering an issue with a CSS locator. The parent has a unique label, which allows me to target the specific child element that I need. @FindBy(css = "[data-qa='select-Seller'] .select__value-container") Webelement seller; public Web ...

Generate a new element using CreateElement and proceed to add content using inner

After two days of relentless searching, I finally found the solution. What's the process for creating an element and then writing it in HTML with innerHTML? function dataPull() { // Connects to my server from which it pulls JSON data containin ...

Using different browsers can cause web fonts to appear rough and pixelated

While exploring the issue of "jagged" or "pixelated" fonts, I made an interesting discovery. After creating a website locally and viewing it in Firefox, the font from Google Webfonts appeared flawless - almost like it was straight out of Photoshop. It wasn ...

Svelte's feature prevents users from inputting on Mapbox

My goal is to prevent user input when the variable cssDisableUserInput is set to true. Here's what I have within my main tags: <div id=userinput disabled={cssDisableUserInput}> <div id="map"> </div> Within my CSS, I&a ...

My website doesn't seem to support Javascript, although it works perfectly on jsfiddle

I was tinkering around on jsfiddle and managed to get my code working flawlessly. However, when I tried to copy and paste it elsewhere, the functionality broke down. It seems that for some inexplicable reason, the code doesn't seem to pass through the ...

Hovering over the Star Rating component will cause all previous stars to be filled

I'm in the process of creating a Star Rating component for our website using Angular 11. I've managed to render the 5 stars based on the current rating value, but I'm having trouble getting the hover styling just right. Basically, if I have ...

Only presenting the search results without revealing the entire table

My goal is to have the search results display only after clicking the search button on the webpage. Currently, the entire table appears while the page is loading, which is not ideal. If I make changes to the variable $sql by altering the query from "Select ...

Display a full-screen image and align it horizontally from the center using CSS styling

When I fill a screen with an image using the following code: width:auto; height:100%; The image fills the screen vertically and almost entirely horizontally, but it gets cropped off on the right side. Is there a way to make the image float centered on th ...

Manipulate classes for buttons in a React component by adding or removing them

I'm attempting to create two buttons that will toggle their class when clicked. When button one is clicked, it should add the "active" class to itself and remove the "active" class from the sibling button. I've made some progress, but I'm e ...