Animation in CSS restarting immediately after finishing the animation is not being postponed

I am looking to create a cool effect using CSS animations where three lines of text fade in one by one, all without the need for JavaScript or other CSS modules.

Below is the code snippet I have tried:

body{background-color: black;}

.text-zone{
  position: absolute;
    left: 20%;
    top: 35%;
  width: 50%;
    max-height: 90%;
}

.text{
  font-size: 60px;
  color: #fff;
  line-height: 53px;
  font-weight: 600;
  font-family: 'Alegreya Sans', sans-serif;
}

#delayedText1 {
  opacity: 0;
  animation-name: fade1;
  animation-duration: 1s;
  animation-delay: 1s;
}

#delayedText2 {
  opacity: 0;
  animation-name: fade2;
  animation-duration: 1s;
  animation-delay: 2s;
}

#delayedText3 {
  opacity: 0;
  animation-name: fade3;
  animation-duration: 1s;
  animation-delay: 3s;
}

@keyframes fade1 {
  from {opacity: 0;}
  to {opacity: 1;}
}

@keyframes fade2 {
  from {opacity: 0;}
  to {opacity: 1;}
}

@keyframes fade3 {
  from {opacity: 0;}
  to {opacity: 1;}
}
<div class="text-zone">
  <div class="text">
    <h1 id="delayedText1">Hi,</h1>
    <h1 id="delayedText2">I'm Faizan,</h1>
    <h1 id="delayedText3">web developer.</h1>
  </div>
</div>

 

However, upon running this code, I encountered an issue where there was a delay of one second before all the text faded in at once and then disappeared after another second. As a beginner in CSS animations, I believe this might be a simple mistake on my end. Can someone please help me understand what went wrong?

Appreciate your assistance!

Answer №1

#delayedText1 { opacity: 0; animation-name: fade1; animation-duration: 2s; animation-delay: 3s; } #delayedText2 { opacity: 0; animation-name: fade2; animation-duration: 2s; animation-delay: 6s; } #delayedText3 { opacity: 0; animation-name: fade3; animation-duration: 2s; animation-delay: 9s; }

For optimal results, kindly integrate this code snippet into your script to ensure seamless functionality. Best of luck!

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

Font malfunctioning on Microsoft Edge and Internet Explorer

Apologies if this seems like a silly question, but I recently imported a font from my computer into a CSS file. While it displays correctly in Chrome, it's not working in Microsoft Edge or Internet Explorer. Unfortunately, I don't have access to ...

Jquery animate not working properly after closing the div for the first time

I am currently working with a div that utilizes the .animate function. The CSS for the div is set as follows: position:fixed; bottom:-240px; The associated animate script looks like this: $("#media").click(function () { $("#mediadetails").animate({ ...

5-item carousel in CSS gridView

I'm currently working on a thumbnail slider project. My goal is to display 5 thumbnails at a time, and allow users to move to the next or previous set of thumbnails by clicking on the corresponding buttons. I attempted to modify an existing slider tha ...

What are the steps to develop an ElectronJS application that displays "Hello world!" in the console after a button click?

Can anyone offer a helping hand? From the depths of imagination to the realms never before conceived by humans. Check out this HTML snippet: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Hell ...

Call upon the web request using `invoke-webrequest`, create a new object with the ComObject "InternetExplorer.Application", and instantiate another object using `

In an attempt to create a task scheduler that retrieves an embed link from a website every hour, I am utilizing PowerShell to fetch the information from the web. $ie = New-Object -ComObject "InternetExplorer.Application" $ie.navigate("https://servicenow. ...

Is it possible to customize the width of text color alongside a progress bar?

My Bootstrap 4 Website contains the following HTML code snippet: <div class="container"> <div class="row"> <div class="col-md-6 mx-auto> <h2>Example heading text</h2> <h6>Example subh ...

Tips on effectively showing padding and margins in django templates and minimizing empty space between rows using bootstrap

Still fairly new to the world of html, Django, and Bootstrap. I find myself struggling with grasping the concept of padding and margins. Is there a clever trick or CSS technique to visually display the padding and margins? I've noticed that margins do ...

Is it considered fashionable to utilize HTML5 data attributes in conjunction with JavaScript?

Currently, I am utilizing HTML5 data attributes to save information such as the targeted DOM element and to initialize events using jQuery's delegation method. An example of this would be: <a href="#" data-target="#target" data-action="/update"> ...

What is the best way to design a Bootstrap grid layout that includes a responsive left column with a minimum width and a scrollable right column?

I'm so close to getting the desired look and behavior, but I'm facing a problem with the scrolling in the right column. The scrollbar is visible but it's not scrolling the content on the right side. It should look like this: . Currently, i ...

Creating a Vuetify dialog sheet with stylish rounded edges

Is there a way to implement round corners for the dialog within the v-bottom-sheet? Note that using style="border-radius:20px;" only affects the overlay, not the dialog itself. <v-bottom-sheet style="border-radius:20px;" v-model=& ...

When the child element's "aria-expanded" attribute is set to true, a CSS class should be dynamically

Is there a way to apply a grey background to the first div when the dropdown is open? I've managed to add CSS based on the child elements' aria-expanding attribute, but I'm unsure how to do it for a parent element. Since I am using Vue, I pr ...

Can you provide guidance on centering a "frame" and aligning elements within it using CSS?

In creating my webpage, I am looking to design a virtual frame that is centered on the page. Within this frame, I want to be able to align various elements like images, text, and more using CSS properties. Let me explain with an example: I envision being ...

Anti-aliasing with @font-face in Internet Explorer versions 7 through 9

Having some trouble getting @font-face to display correctly in IE, and I haven't found a solution yet. I've looked into this resource: but unfortunately it didn't work on my Windows 7 IE. Does anyone have a better suggestion? ...

Ways to constrain checkbox choices to only one within an HTML file as the checklist with the checkboxes is being created by JavaScript

I am working on developing an HTML dialogue box to serve as a settings page for my program. Within this settings page, users can create a list of salespeople that can be later selected from a drop-down menu. My current objective is to incorporate a checkbo ...

Customizing the appearance of Jquery UI Accordion Headers

Trying to integrate the JQuery UI accordion into my JQuery UI modal dialog has been causing some alignment issues. Despite following code examples found online, such as http://jsfiddle.net/eKb8J/, I suspect that the problem lies in CSS styling. My setup i ...

"Sturdy Accordian Design: No Collapsing Issues with

Hello everyone, I'm attempting to recreate a collapsing accordion feature that I came across on https://getbootstrap.com/docs/4.1/components/collapse/. However, I'm facing issues as the accordions are not collapsing as expected. Strangely, they b ...

Adding HTML content inside an iFrame at a specific cursor position in Internet Explorer

Does anyone know a method to insert HTML into an iFrame specifically for IE? I have been using execCommand insertHtml in Chrome and Firefox, but it doesn't seem to work in IE. I was able to paste HTML into a content editable div using pasteHTML, howe ...

Click on the div element to make it fade in, and then click either inside or outside the div to make it

Recently, I successfully created a code that enables users to open a second div by clicking on a specific div. The second div is initially hidden with the CSS property display: none. To close it, users simply need to click on the same div again. Although ...

Tips for preventing unstyled content flash when updating CSS files dynamically

The following jQuery function is used to replace CSS files: function UpdateTheme(theme) { var links = $("link"); var _t = theme; $.each(links, function (i, link) { var _h = $(link).attr('href'); _updatedHr ...

The concept of nested lists and the importance of z-indexing

I am in the process of creating a navigation menu for a website that includes submenus. However, I am encountering an issue with the submenu sliding down and not lying behind the main navigation as intended. I have attempted to use z-index to address this ...