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

Simply click and drag a document from your file explorer directly into the desired text field to instantly generate a clickable

I am interested in dragging a file from our Windows server and dropping it onto a text area on a webpage. The link that would be generated will look something like this: <a href="\\fileserver\folder\pizza_2.pdf">filename.pdf< ...

Challenges with dropdown menus in the sub navigation area

I am currently working on a navigation system that includes three levels of sub-navigation elements. While the functionality is fine up to the third level, it only displays one subcategory instead of multiple categories as intended. I suspect there might ...

Is your Javascript navigation functioning properly on some submenus while encountering issues on others?

If you visit , you'll notice that it's a visually appealing site. The navigation submenus seem to be functioning properly, HOWEVER upon inspecting the element, you'll notice that under the PRICING tab, there are submenus that have the same c ...

Best Practices for Implementing an Autocomplete Search Box in HTML

I'm currently working on implementing the code below and I could really use some guidance. Despite reading and watching Google Developers' YouTube videos, I am still struggling as I am new to this. My main goal is to integrate an autocomplete sea ...

The error message "Cannot read property 'addEventListener' of undefined" occurred while trying to register the service worker using `navigator.serviceWorker.register('worker.js')`

I'm grappling with a JavaScript issue and need some help. You can find the demo of the functioning script by the author right here. I've implemented the same code as displayed on his demo page. I've downloaded the worker.js file and ...

Challenge with CSS Layering

I'm currently experiencing some issues with layering on my website. The problem at hand is that visitors are unable to interact with links within the div layers for some unknown reason. They can't click on the sidebar images or highlight text. I& ...

Tips on employing useState within useEffect?

Attempting to refactor my component from react.component to hooks has been a bit challenging. I am struggling to properly utilize the state variable offsetTop. It seems like the value is not being set when needed. In my first attempt: const [offsetTop, se ...

transferring data from JavaScript to PHP variables

Currently, I am working on a project that involves using ajax to access the database asynchronously. The value retrieved is stored in a JavaScript variable like this: var content=xmlhttp.responseText; My next step is to pass this value to the PHP module ...

How to retrieve the third party child component within a Vue parent component

Within my example-component, I have integrated a third-party media upload child component called media-uploader: <example-component> <form :action= "something"> // Other input types <media-upload :ref="'cover_up ...

Is it possible to extract user-defined keywords from the URL?

Is it possible to implement dynamic functionality like this using PHP on my website (www.mywebsite.com)? If a user types www.mywebsite.com/banana into the URL bar, can my website take the keyword "banana" as input and search for it in a database table? ...

Tips for removing an element from an array in a JSON structure using its unique identifier

This problem seems to be fairly straightforward but it’s giving me some trouble. Here is the JSON structure I'm working with: "playlists" : [ { "id" : "1", "owner_id" : "2", ...

Every time I hover, my jQuery code keeps repeating the hover effect

I am currently facing an issue that has me stumped on finding a solution. The problem arises when I hover over the .div multiple times, the animation just doesn't stop and keeps running continuously. What I aim for is to have the .hidden element fad ...

Using JSON to serialize form data before sending it in HTML

I am in the process of developing a system that requires redirecting a user to a C# application using a form that POSTs data as a serialized JSON string along with the user. The form would be structured like this: <form action="c#methodLocation" metho ...

Is it possible to utilize $.each() in combination with $.ajax() to query an API?

I am dealing with an array containing 2 values, and for each value, I need to make an AJAX query to an API to check the stock availability. If there is stock for both values, a certain message should be executed, otherwise, a different message. This check ...

An image inside this stylishly framed photo with rounded corners

.a { clip-path: polygon(10% 0, 100% 0%, 100% 100%, 10% 100%,10% 60%, 0% 50%, 10% 40%); } .a { position: relative; width: 500px; height: 500px; background:url("https://cdn.pixabay.com/photo/2020/02/16/07/55/thailand-4852830_960_720.jpg"); border-radi ...

Attempting to output properties from an Express/Mongo API by utilizing a React.js frontend

I am currently in the process of developing a simplistic fictional sneaker application with the MERN stack. While I wouldn't classify myself as a beginner, I'm also not an expert. I successfully created the backend and generated a json rest-api. ...

Having trouble locating the existing placeholder in my WordPress theme that I'm trying to change

I am currently using the KuteShop WordPress Woo-commerce template and I want to customize the Placeholder Text "I'm searching for..." and "All Cate." shown in the image below: Despite my efforts, I have been unable to locate where I can make these ch ...

Creating specific CSS classes for individual slides in a basic slider framework

So, I have a rather simple slider that is created using only CSS. Each slide has unique labels for navigation buttons. The main question here is: how can I dynamically add or remove classes to specific items on the slide only when that particular slide is ...

Creating a dropdown menu and adjusting the content below

Feeling stuck in one place with my code here: link The side navbar animation is almost what I want, but clicking one option opens all of them. Hoping for a similar effect like this page: link $(document).ready(function() { $('.interfejs, .proces ...

How can I send dynamic props between pages using Next.js?

I am currently exploring Next.js and attempting to create a page (index.js) that fetches data about different countries and then displays this information. I would like each country element displayed on the page to have a button that leads to another page ...