Fixing a CSS animation glitch when using JavaScript

I'm facing an unusual issue with my CSS/HTML

Check out my code below:

a:hover {
color: deeppink;
transition: all 0.2s ease-out
}

.logo {
height: 300px;
margin-top: -100px;
transition: all 0.2s ease-in;
transform: scale(1)
}

.logo:hover {
transition: all 0.2s ease-in;
transform: scale(1.05)
}


.p1 {
margin-left: 50px
}

.p1::first-letter {
font-size: 2em;
font-style: italic;
font-weight: bold
}

.p dwnld1 {
margin-top: 3%
}

.contactcontenu {
text-align: center;
margin-top: 5%
 }
<html>
<link href="stylekalaha.css" rel="stylesheet" type="text/css" />
<head>
<title>Le Jeu du Kalaha</title>
</head>

<body>

<h1> <img class ="logo" src="images/logoweb.png"></h1>

<div class="bandeau">
<div class="left"> <a href="index.html"> Projet </a></div>
<div class="gauche"><a href="regles.html"> Règles </a></div>
<div class="droite"><a href="download.html"> Téléchargement </a></div>
<div class="right"> Contacts </div>
</div>

<div class="contactcontenu"> <center>
<form action="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="14753a767b617a7567546d757c7b7b3a7266">[email protected]</a>" name="envoi" method=POST enctype="text/plain">
<table border="0">
<tr>
<td>
<p><b>Nom : </b><input name="nom"size=50 maxlength=50></p>
<p><b>Prenom : </b><input name="PRENOM"size=50 maxlength=50></p>
<p><b>Mail : </b><input name="mail" size=50 maxlength=50></p>
<textarea name="message" cols="60" rows="5"></textarea>
</td>
</tr>
</table>
<input type="submit" value="Envoyer" name="Envoyer">
<input type="reset" name="Submit" value="Effacer">
</form>


</center></div>
<div class="end"> </div>
</body>
</html>

My transitions work perfectly on other HTML files, but not on this one. When I load the webpage, my div class=bandeau is animated, swiping from the middle of the page to the top. If I remove my JavaScript, there's no issue.

So why does my JavaScript affect this particular HTML page? It works fine on others, where my logo is animated as expected. The image transition + post-loading transition seems strange...

Answer №1

It appears that your link tag is not placed inside the head section of your HTML, causing your stylesheet to not load properly.

a:hover {
color: deeppink;
transition: all 0.2s ease-out
}

.logo {
height: 300px;
margin-top: -100px;
transition: all 0.2s ease-in;
transform: scale(1)
}

.logo:hover {
transition: all 0.2s ease-in;
transform: scale(1.05)
}


.p1 {
margin-left: 50px
}

.p1::first-letter {
font-size: 2em;
font-style: italic;
font-weight: bold
}

.p dwnld1 {
margin-top: 3%
}

.contactcontenu {
text-align: center;
margin-top: 5%
 }
<html>

<head>
        <link href="stylekalaha.css" rel="stylesheet" type="text/css" />
<title>Le Jeu du Kalaha</title>
</head>

<body>

<h1> <img class ="logo" src="images/logoweb.png"></h1>

<div class="bandeau">
<div class="left"> <a href="index.html"> Projet </a></div>
<div class="gauche"><a href="regles.html"> Règles </a></div>
<div class="droite"><a href="download.html"> Téléchargement </a></div>
<div class="right"> Contacts </div>
</div>

<div class="contactcontenu"> <center>
<form action="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f293dc909d879c9381b28b93a9a9dc9480">[email protected]</a>" name="envoi" method=POST enctype="text/plain">
<table border="0">
<tr>
<td>
<p><b>Nom : </b><input name="nom"size=50 maxlength=50></p>
<p><b>Prenom : </b><input name="PRENOM"size=50 maxlength=50></p>
<p><b>Mail : </b><input name="mail" size=50 maxlength=50></p>
<textarea name="message" cols="60" rows="5"></textarea>
</td>
</tr>
</table>
<input type="submit" value="Envoyer" name="Envoyer">
<input type="reset" name="Submit" value="Effacer">
</form>


</center></div>
<div class="end"> </div>
</body>
</html>

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

showcase every value upon submission in the form with options to edit and delete

Is it possible to display all values submitted in a form with edit and delete buttons? Currently, only one value is being displayed at a time. Whenever a new value is displayed, it replaces the old one. How can this be fixed? You can fin ...

Unable to change the color of InputBase component's placeholder in React.js

I've been attempting to modify the color of the placeholder in an inputbase. I came across several methods online and tried implementing them, but none have been successful. Below are the codes I have tried. <InputBase id="input-id&quo ...

Obtain the ending section of a URL using JavaScript

Is it possible to extract the username from a URL like this example? I'm interested in seeing a regex method for achieving this. The existing code snippet only retrieves the domain name: var url = $(location).attr('href'); alert(get_doma ...

Tips for effectively splitting arrays nested within an array using JavaScript

Here is an example of slicing an array to generate a new one: var array= [ [1,"dataA","dataB","dataC","dataD"...], [2,"dataA","dataB","dataC","dataD"...], [3,"dataA","dataB","dataC","dataD"...], [4,"dataA","dataB","dataC","dataD"...]... ...

Conceal the scrollbar when the expansion panel is in its collapsed state

One issue I am encountering is that the scroll-bar appears when the expansion panel is collapsed, but not when it's expanded. Here are the references: Collapsed Expanded <mat-expansion-panel class="panel"> <mat-expansion-panel-he ...

Performing a `contains` operation with JQuery on this variable or object

Help! I'm completely confused about this problem. First, I am trying to use jQuery to select an li object and then check if a certain text exists within it using the "contains" function. However, for some reason, the line with the "contains" function ...

Issues encountered with AngularJS directive binding inner content not functioning as expected

I am currently developing a feature toggle directive, which requires a check to be performed in order to display content if the check is successful. I want the directive to replace itself with its content without creating a new child scope (so I'm try ...

What is the best way to bind a model to a directive in Angular.js?

I have been experimenting with different methods to create a two-way binding between my directive and repeater, but so far I haven't been successful. Although I have tried various strategies suggested online, the current setup does not pass item.myDat ...

Reverse the order of jQuery toggle animations

Looking for something specific: How can I create a button that triggers a script and then, when the script is done, reverses the action (toggles)? (I am currently learning javascript/jquery, so I am a beginner in this field) Here's an example: ...

Exploring the mechanics of JavaScript and jQuery Ajax: What's the secret to its function

It's common knowledge that browsers are single-threaded, meaning they can only either render the UI or execute Javascript snippets. While web workers offer a way to achieve multi-threading, let's focus on the default behavior. I'm curious a ...

Bootstrap overrides the color of the calendar year in jQuery UI

I am facing an issue where the CSS styles of my jQuery UI calendar are being overridden by the Bootstrap CSS styles. Take a look at the screenshot provided. As you can see, the text color of the calendar's year is not black as intended. https://i.ss ...

Managing state in React for a nested object while still maintaining the data type of the

Exploring the question further from this particular query Updating State in React for Nested Objects The process of updating nested state involves breaking down the object and reconstructing it as shown below: this.setState({ someProperty: { ...this.stat ...

How can one determine the most accurate box-shadow values?

I am trying to extract the precise box-shadow parameters from a CSS style rule generated by the server. My main focus is determining whether the element actually displays a visible shadow or not. There are instances where the shadow rule is set as somethi ...

Capture data from a Telegram bot and store it in a Google Sheet

I am trying to use a spreadsheet through a Telegram bot as a TODO list so that when I input something on my phone, it is saved in the spreadsheet. (I'm following this tutorial https://www.youtube.com/watch?v=XoTpdxbkGGk, which seems accurate with Goog ...

Creating a Webgrid in MVC and integrating it with a custom class in AngularJS

Hey there, I'm a beginner when it comes to AngularJS and I'm looking to bind the webgrid within the method of AngularJS. $scope.SaveDetails = function () { debugger; var UserID = '@Session["ID"]'; ...

Arrange Drifting Components in a Fluid Layout Grid

I am in the process of creating a unique sticky note website where I want to arrange the notes in a grid format. As the window size decreases, the notes should automatically reorganize to fit the width and allow for vertical scrolling. My goal is to achiev ...

Tips for resolving the "Unexpected reserved word" error during the installation of Laravel Jetstream

I have been following the steps outlined on to set up Laravel Jetstream. Upon running artisan jetstream:install, I selected Livewire support, API support, email verification, and PHPUnit support for installation. Next, I executed npm install as per the ...

Steps to Incorporate Whitespace in a Mailto Link for Generating a Hyperlink

I am currently using Outlook 2007 and I need to include a hyperlink to a website in the body section of an email link. The URL of the site contains spaces. When I try to use %20 to represent the whitespace, it does display as expected but there is an issu ...

Sending a multi-dimensional array to the server using PHP via POST

Similar Question: multi-dimensional array post from form I am looking to transfer data from the client to the PHP server using jQuery's $.post() method. Once the data reaches the server, I want the $_POST['myList'] variable to be in one ...

Step-by-step guide on how to display chosen values in a multi-select dropdown menu

How can I dynamically select values in a multi-select box based on an array using Vue.js? I've attempted a solution but it's not working as expected. Any suggestions or help would be greatly appreciated. <div id="app"> <select class="m ...