0
I built a basic file with a simple menu. I simplified it to the maximum to try to find the problem and I can’t.
The problem is that when entering the site, the animation specified in the Transition css starts to work automatically by zooming the buttons and changing their colors, but only when importing the file . css If I use the tag to insert the css, the animation doesn’t work unless the cursor overrides the button.
Below with all the content together, working as I need, just with the :Hover
<html>
<head>
<style type="text/css">
.escolha{background-color: #999; color: #fff;}
.escolha ul { list-style: none; margin-left: -40px;}
.escolha ul li {background-color: #999; padding: 10px 0; cursor: pointer; transition: all 0.5s ease 0s;}
.escolha ul li estado{width: 50%; padding: 10px; transition: all 0.5s ease 0s;}
.escolha ul li cidade{width: 50%; padding: 10px; transition: all 0.5s ease 0s;}
.escolha ul li:hover {background-color: #6ab4c6; transition: all 0.5s ease 0s;}
.escolha ul li:hover estado{background-color: #0088a4;}
.escolha ul li:hover cidade{padding: 10px 10px 10px 20px;}`
</style>
</head>
<body>
<div class="escolha">
<ul>
<li><estado>SP</estado><cidade>São Paulo</cidade></li>
<li><estado>SP</estado><cidade>São Caetano</cidade></li>
<li><estado>PR</estado><cidade>Curitiba</cidade></li>
</ul>
</div>
</body>
</html>
Below with separate files, importing . css, where the animation takes place
.escolha{background-color: #999; color: #fff;}
.escolha ul { list-style: none; margin-left: -40px;}
.escolha ul li {background-color: #999; padding: 10px 0; cursor: pointer; transition: all 0.5s ease 0s;}
.escolha ul li estado{width: 50%; padding: 10px; transition: all 0.5s ease 0s;}
.escolha ul li cidade{width: 50%; padding: 10px; transition: all 0.5s ease 0s;}
.escolha ul li:hover {background-color: #6ab4c6; transition: all 0.5s ease 0s;}
.escolha ul li:hover estado{background-color: #0088a4;}
.escolha ul li:hover cidade{padding: 10px 10px 10px 20px;}
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/stylepaginas.css" media="screen, handheld" />
</head>
<body>
<div class="escolha">
<ul>
<li><estado>SP</estado><cidade>São Paulo</cidade></li>
<li><estado>SP</estado><cidade>São Caetano</cidade></li>
<li><estado>PR</estado><cidade>Curitiba</cidade></li>
</ul>
</div>
</body>
</html>
I tried using jsfiddle to test but the error does not happen, only in localhost and online version.
If anyone has a solution, I’ll thank you very much.
Guy the way you explained could not understand the problem... testing know code here when the page loads nothing happens, but when you put the mouse the animation works normally... what is the problem in fact?
– hugocsl
The problem is that, in the version that imports the css, the buttons simply animate themselves, without occurring the Hover. It’s as if they don’t have any specification and, after importing css, they grow and acquire the correct colors. ???
– Varal Studio
I tested the two modes here and the operation was the same, IE, animations only work in the Hover, as it should be.
– Sam
@Varalstudio and what is the correct way that should be the functioning? Explains better...
– user148754
It should only work with the Hover. When I use import it works more or less like this: The buttons appear without any formatting, only text in black and without background and simply grow until they are in the final formats, with gray background and blank text. This "grow up" that wasn’t supposed to happen. I don’t know if I can link to the site where I took the test...
– Varal Studio
Either you are importing the wrong . CSS or the . CSS that you are importing has other styles and properties that are disturbing the CSS that you presented here.
– hugocsl
I thought of that possibility, so I erased all other information and left only what mattered. I did some tests here and found that it is a unique problem of Chrome, whether on Windows, MAC or android.
– Varal Studio
If the link is not deleted, follow: http://varalstudio.com.br/teste/teste1.php Every time I update, the animation happens again.
– Varal Studio
The one below works: http://varalstudio.com.br/teste/teste2.php Here the css is inside the <style tag>
– Varal Studio
This line seems wrong Transition is usually outside Hover, remove Transition aaqui and test
.escolha ul li:hover {background-color: #6ab4c6; transition: all 0.5s ease 0s;}
remove Transition: all 0.5s Ease 0s from that class– hugocsl
The error persists. Did you test the links? Appeared what I am trying to explain?
– Varal Studio