Image fading in CSS animation.flow

Looking to achieve a fading in animation effect on an image using opacity. The goal is for the image to appear as if it is fading in from left to right, not sliding.

While I have a solid approach in mind, currently the image remains visible at all times. However, the animation of the white div is working smoothly thus far.

<div class="font-grotesk h-[500px] bg-gray-900">
  <div class="flex h-[100px]">
    <div class="second-logo max-w-[150px] bg-white">
      <img src="https://placehold.co/90x30" class="min-w-[150px] overflow-hidden px-[14px] py-9" />
    </div>
  </div>
</div>

Here is my CSS:

@tailwind base;
@tailwind components;
@tailwind utilities;

.second-logo {
  animation: showHide 3s;
}

@keyframes showHide {
  0% {
    width: 0;
  }

  100% {
    width: 100%;
  }
}

View the playground here.

Answer №1

I utilized a clip path technique to create a smooth reveal effect for the entire div, transitioning from left to right.

.reveal {
  animation: reveal 600ms forwards;
  opacity: 1;
}

@keyframes reveal {
  0% {
    clip-path: inset(0 100% 0 0);
  }

  100% {
    clip-path: inset(0 0 0 0);
  }
}

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

What is the best way to navigate down a page using the <a> tag?

I'm working on creating a mini wiki page on my website that will have a table of contents at the top. Users can click on a link in the table of contents and it will automatically scroll down to the relevant section of the page. I know this involves us ...

Receive notification of alert content when it is displayed

Having an HTML page with the following script: <Script> function Run() { alert("The Content Here"); return true; } </script> <button onclick="Run();">I Want It Now</button> If I were to open this page using firefox or Chrome, and ...

Client Blocking Issue: ExpressJS encountering problem loading JavaScript file

I recently deployed my express app on a server (specifically, I used Heroku). Everything functions perfectly when I test the app locally. However, when I access the app online, I encounter an issue with a net::ERR_BLOCKED_BY_CLIENT error. This error states ...

Exploring the application of the PUT method specific to a card ID in vue.js

A dashboard on my interface showcases various cards containing data retrieved from the backend API and stored in an array called notes[]. When I click on a specific card, a pop-up named updatecard should appear based on its id. However, I am facing issues ...

I am eagerly awaiting for the table command "rowspan" to finally start functioning properly. Right now, it seems to be completely ignored

While working on my html project to create a basic table, I encountered an issue halfway through. My goal was to make the second to last row double in size by using rowspan="2", but unfortunately nothing changed. Can someone assist me with this problem? ...

Tips for preventing horizontal list items from stacking on top of each other in React

After successfully creating a horizontal list using HTML and CSS, I encountered an issue when trying to replicate the same code in my React application. In React, the list elements were stacking on top of each other due to a styling conflict with the style ...

What storage method does Stack Overflow use for storing questions and answers: HTML files or databases?

Perhaps this question is a bit of a puzzle, so let me explain: I am working on a practice web project at university to develop a questions and answers platform. My goal is to understand how websites like Stackoverflow manage storing the questions and answe ...

sending additional parameters within a URL query string

Is it even possible to include a URL with get parameters within another get parameter? For example, I'd like to pass http://example.com/return/?somevars=anothervar as the value for the "return" parameter as shown below: http://example.com/?param1=4&a ...

Shift all content to the right when viewing on mobile devices

I'm looking to create space for a menu on the left side, similar to the one on Mashable's mobile view. How can I move all the content to the right? Feel free to resize the window and compare with . Thank you. Best regards, Marius ...

What causes the disappearance of CSS styles when attempting to modify the className in react js?

I am currently working on a basic react application, and I am trying to dynamically change the name of a div element using the following code snippet - <div className={'changeTab ' + (page.login ? 'leftSide' : 'rightSide')} ...

spacing in html tags and div

Can someone assist me with this HTML element issue? <div class="sample"> <p>hello</p> </div> I am trying to eliminate white space between the <p> and <div> tags. Your help is much appreciated. Thank you! ...

Error: Cannot assign type 'null' to click event type Array. I have not been able to locate a solution to my issue in other related queries

Can someone assist me with my latest Angular project? I encountered an issue with the (click)="onOpenModal(null, 'add')" function call. Since it's meant to open a modal without an existing employee, I passed in null as a placeholde ...

Is there a way I can implement a user-friendly playlist feature in my object-oriented HTML5 JS audio player that allows users

I have created a functional audio player using HTML5 and Javascript, along with some basic CSS. However, I am looking to enhance it by adding a clickable playlist feature. I want the name of the currently playing audio track to be displayed, and users shou ...

Double Pop-up Issue with IE 11 - Two Consecutive Leave or Stay on this Page Prompts

This issue is specific to Internet Explorer. I have a webpage that contains a Close button. When the Close button is clicked with any unsaved changes on the page, a "Leave or stay on this page" popup appears. Clicking the Leave button functions as expected ...

Tips for ensuring an image fits perfectly within a MUI grid

I am currently working on an application that involves a collection of cards. My tech stack includes React and MUI v5. One issue I've been facing is with the grid layout, specifically in trying to keep the image size consistent within the grid item. ...

Align the text vertically in a Bootstrap button

Can anyone lend a hand with vertically aligning text in a Bootstrap button? When I use the align-middle class, the text is aligned as desired. However, if I use the align-top class, the text remains top-aligned no matter what I do. Any suggestions? Here& ...

Width of the Div is not dynamically adjusting

overflow:auto; margin: 0 auto; padding-top:20px; min-height: 100%; border: 1px solid black; background: #E8E8E8; -moz-box-shadow: 0 0 30px 5px #999; -webkit-box-shadow: 0 0 30px 5px #999; I may not have included all the necessa ...

Using JavaScript to only update the CSS background image when the source image changes

Is it feasible to dynamically update the CSS image referenced by a provided URL in "background-image: \"<some-url>\" using JavaScript, but only when the source image is modified on the server? The idea is to cache the image a ...

Move the textbox on the image by dragging it with the mouse

I need help figuring out how to move text on an image. I am currently designing an online custom shirt design website where users can add text to images. However, I am having trouble allowing users to adjust the position of the text on the image using th ...

Only by refreshing can submission be prevented effectively

My website has a page that redirects to another page. On the second page, I have prevented the default form submission and implemented my own custom functionality using the following code: <!DOCTYPE html> <html> <head> <ti ...