The CSS animation style does not seem to be functioning properly on a div element nested within a flexbox container

Could someone kindly take a look at the code snippet below and help me troubleshoot why the animation for the image and info divs is not functioning properly? This block of code is from the HTML file for the about page. (I enclosed the content within a div and positioned it relatively)

{%extends 'layout.html' %}
{%block content %}

.about {
  align-items: center;
  top: 5em;
  display: flex;
  flex-direction: row;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

#image {
  animation-name: image2;
  animation-duration: 3s;
  animation-delay: 3s;
  animation-fill-mode: forwards;
}

.image-file {
  border: none;
  border-radius: 100px;
  width: 200px;
  height: 200px;
  margin-right: 100px;
}

#info {
  text-align: center;
  max-width: 100%;
  -webkit-animation-name: info2;
  -webkit-animation-duration: 3s;
  -webkit-animation-fill-mode: forwards;
  animation-name: info2;
  animation-duration: 3s;
  animation-fill-mode: forwards;
}

@keyframes image2 {
  0% {
    left: -100px;
  }
  100% {
    left: 0;
  }
}

@-webkit-keyframes info2 {
  0% {
    right: -100px;
  }
  100% {
    right: 0;
  }
}

@keyframes info2 {
  0% {
    right: -100px;
  }
  100% {
    right: 0;
  }
}
<div class='head1'>
  <h class='head'>Welcome to the Home page</h>
</div>
<div class='about'>
  <div id='image'>
    <image class='image-file' src='https://via.placeholder.com/150' alt='nelson'>
  </div>
  <div id='info'>
    <h class='head'>About me</h>
    <p class='text'>I am a web developer specialized in vanilla CSS,<br>HTML, and Flask. <br>But I am continuously learning new things.</p>
  </div>
</div>

Answer №1

Consider including the following code snippet:

#image {   position:absolute; }

Answer №2

If you're utilizing Firefox, access the dev tools, find the div image, and check out the style information.

Here's an example of what you might see:

https://i.sstatic.net/Xs9nw.png

Take note that left is grayed out. Next, hover over the "i" circle. You'll receive a message indicating "left has no effect because the element is not positioned".

This appears to be the issue at hand:

.about {
  align-items: center;
  top: 5em;
  display: flex;
  flex-direction: row;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

#image {
  animation-name: image2;
  animation-duration: 3s;
  animation-delay: 3s;
  animation-fill-mode: forwards;
  position: relative;  /* added */
}

.image-file {
  border: none;
  border-radius: 100px;
  width: 200px;
  height: 200px;
  margin-right: 100px;
}

#info {
  text-align: center;
  max-width: 100%;
  -webkit-animation-name: info2;
  -webkit-animation-duration: 3s;
  -webkit-animation-fill-mode: forwards;
  animation-name: info2;
  animation-duration: 3s;
  animation-fill-mode: forwards;
  position: relative;  /* added */
}

@keyframes image2 {
  0% {
    left: -100px;
  }
  100% {
    left: 0;
  }
}

@-webkit-keyframes info2 {
  0% {
    right: -100px;
  }
  100% {
    right: 0;
  }
}

@keyframes info2 {
  0% {
    right: -100px;
  }
  100% {
    right: 0;
  }
}
<div class='head1'>
  <h class='head'>Welcome to the Home page</h>
</div>
<div class='about'>
  <div id='image'>
    <image class='image-file' src='https://via.placeholder.com/150' alt='nelson'>
  </div>
  <div id='info'>
    <h class='head'>About me</h>
    <p class='text'>I am a web developer specialized in vanilla css,<br> html and flask. <br>But i am developing further.</p>
  </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

Repeated information in HTML tables

I am currently working with two HTML tables and two sets of JSON data. Initially, I load one table with the tableData which has a default quantity of 0. In my HTML form, there are three buttons - save, load draft, and edit. Upon clicking on load draft, I p ...

When using equal-width columns in Bootstrap, the columns will be stacked one on top of the other

When I utilize Bootstrap 5, I am encountering an issue where equal width columns are being displayed one underneath the other. To illustrate, here is a simple example directly from the Bootstrap website: <link rel="stylesheet" href="https://cdn.jsd ...

Pressing the close button will shut down all bootstrap models

Is there a way to fix an issue where closing Model2 also dismisses the main Model? In my code, there is a button "Launch modal" to open the Model, and within the Model, there is a button "Launch modal2" to open a new model called Model2. However, when ...

Updating user schema in Angular to include question_id in list of bookmarks

Schema: var UserSchema = new Schema({ ques_bookmarks: [{ type: String }], }) Controller: .controller('questionsController', function(questionsFactory, $routeParams, $scope) { var that = this; questionid = $routeParams.id; stats = fal ...

Website image container for optimal responsiveness

I recently started using Bootstrap 5 to build a new website and I encountered an issue with the layout of my feature and mission sections. I wanted the images to move above the text when the viewport is scaled down to mobile or tablet size, but I wasn&apos ...

Iframe not functioning properly on Internet Explorer versions 8-11 when using WordPress

I'm having trouble getting my WordPress video to display when using an iframe. When I try to view it in Internet Explorer, the video automatically loads in Windows Media Player instead of playing through the iframe. The video files are local mp4s and ...

What is the reason behind the label value persistently showing up after the page is refreshed?

Why is the data that I deleted from the database still showing in the label? Even after running the delete function and reloading the page. The label should not have any value once the data is deleted. Here is my code: $(document).on('click', ...

Ways to eliminate the unusual dashed space in ReactJS using Bootstrap

While developing an app with NextJS and Bootstrap, I noticed a strange dashed gap at the top of the screen in the elements tab. Despite checking for margin or padding-top properties on any element, there doesn't seem to be a clear cause for this issue ...

Python web scraping for IMDb data

I am currently working on analyzing data from a previous Harvard CS 109 course and I'm having trouble extracting the ratings from the top 250 most voted movies in the dataset. It seems like there are two instances of td.ratingColumn, one containing th ...

creating hidden and displayed forms using php

I am in need of a hidden form that only becomes visible after the user clicks a button. Once the submit button is pressed, the form should return to its invisible state. Does anyone have any suggestions on how to achieve this functionality? I believe it m ...

error in css styling detected

Why was the CSS style "background-position: center;" missed? It was because the background will override the background-position property. <html> <head> <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" ...

Is it possible to break a single word when word wrapping?

Is it possible to apply word-wrap: break-word to just one word within an element without affecting the entire element? I find that when I apply it to the entire element, it looks messy. I tried searching for a solution but couldn't find anything. Has ...

What is the best way to ensure that all background images are displayed in IE when printing?

I am currently working on formatting a page for printing in Internet Explorer. I have encountered an issue where when I select the "Print background and images" option in Page Setup and preview the page, only certain icons are displaying. However, all icon ...

Tips for customizing the appearance of buttons in a JavaScript bxSlider

Take a look at my landing page: In the upper section, you'll find three buttons that allow you to switch between different slides. These buttons are named: credi5, credi10, and credi15. Now, I want to replace those buttons with images... specificall ...

Navigating a puzzle menu in web design can be simplified with a few easy steps

When it comes to executing my design ideas, I have 2 options in mind. My main concern is which one will offer more flexibility for adding animations and tinkering with CSS later on. The first idea involves a navigation menu where hovering over an item mak ...

What is the method I can use to turn off an HTTP-EQUIV refresh with JavaScript

I am in the process of creating a status page that needs to refresh regularly. To achieve this, I have added a http-equiv refresh tag in the <head> section that automatically refreshes the page every minute: <meta http-equiv="Refresh" id="refres ...

The content within a container that has flex-grow: 1 is exceeding its bounds instead of being able to scroll

I am currently facing an issue with a container that is set to grow within a fixed size container and I need help figuring out how to make the content wrapper element scrollable. Specifically, the flex-grow container houses a div that is larger than the c ...

When implementing Critical CSS, the Jquery function fails to execute upon loading

Currently, I am working on optimizing my website at . In an attempt to improve its performance, I decided to implement critical CSS using penthouse. The Critical CSS code can be found here, generously provided by the main developer of penthouse. However, ...

The strange behavior of !important, display:none, and .height()

While working with a piece of JS code yesterday, I stumbled upon something peculiar. There was a div element that was initially hidden using display:none, and I was utilizing its height in some JavaScript calculations. Everything was functioning properly u ...

Reposition the button to the right within a div

I am having trouble moving a button from the left side to the right side in Bootstrap 4. I have attempted using both mr-auto and float-right, but neither seems to be working. Here is my code: <!-- Page Content --> <div class="container"> ...