Mozilla and Chrome difference on CSS - html

I have a problem with my CSS. It works well on chrome but not on Mozilla Firefox.
My code is getting twitter icon to the left, when mouse is over the icons.
My HTML code:
<header>
<div id="animation">
<a href="http://www.facebook.com.tr">
<img id="socialiconface" src="images/facebook.png">
</a>
<a href="http://www.twitter.com.tr">
<img id="socialicon" src="images/twitter.png">
</a>
</div>
</header>
And my CSS is there:
#socialicon {
position: absolute;
-webkit-transition-property: margin-right;
-moz-transition-property: margin-right;
-webkit-transition-duration: 2s;
-moz-transition-duration: 2s;
width: 40px;
height: 40px;
top: 5px;
right: 2px;
}
#socialiconface {
position: absolute;
width: 50px;
height: 50px;
top: 5px;
right: 2px;
}
#socialicon:hover {
margin-right: 70px;
}
Whatever I tried, that doesn't work unfortunately, could someone help me out?

Update this line to cover the whole animation div, otherwise you will have to follow the icon with your mouse for it to animate bacause it moves away.
#animation:hover #socialicon {
margin-right: 70px;
}
Full code:
#socialicon {
position: absolute;
-webkit-transition-property: margin-right;
-moz-transition-property: margin-right;
-webkit-transition-duration:2s;
-moz-transition-duration: 2s;
width:40px;
height: 40px;
top: 5px;
right: 2px;
}
#socialiconface {
position:absolute;
width:50px;
height: 50px;
top: 5px;
right: 2px;
}
#animation:hover #socialicon {
margin-right: 70px;
}
img {
background: #ccc;
}
<header>
<div id="animation">
<img id="socialiconface" src="images/facebook.png" />
<img id="socialicon" src="images/twitter.png" />
</div>
</header>

The reason is because once the img moves past the mouse cursor, the :hover style is no longer applied. Even Chrome does this, but it seems that it doesn't check the :hover state until the mouse moves.
You can try animating right instead of margin and giving some right padding instead:
#socialicon {
position: absolute;
-webkit-transition-property: right;
-moz-transition-property: right;
-webkit-transition-duration: 2s;
-moz-transition-duration: 2s;
width: 40px;
height: 40px;
top: 5px;
right: -68px;
padding-right: 70px
}
#socialiconface {
position: absolute;
width: 50px;
height: 50px;
top: 5px;
right: 2px;
}
#socialicon:hover {
right: 2px;
}
<header>
<div id="animation">
<a href="http://www.facebook.com.tr">
<img id="socialiconface" src="images/facebook.png">
</a>
<a href="http://www.twitter.com.tr">
<img id="socialicon" src="images/twitter.png">
</a>
</div>
</header>

Related

CSS underline animation not working at all [duplicate]

This question already has answers here:
How to animate underline from left to right?
(3 answers)
Closed 6 months ago.
I am trying to make an underline animation that comes from the middle and extends to the sides
I copied the code from an example i found online which was working but not on my case
I have added the code on jsfiddle below
you are looking in the beginning of the css for .htext:after and .htext:after:hover
https://jsfiddle.net/wvm2sfp0/1/
body {
background: rgb(14, 13, 13);
color: white;
width: 100%;
}
header {
width: 100%;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
background: linear-gradient(to top, rgba(0, 0, 0, 0), rgb(0, 0, 0, 0.8));
}
a {
text-decoration: none;
color: inherit;
}
p {
color: white;
}
.div1 {
background-image: url(../images/Group\ 10.png);
}
.htext {
margin-right: 3%;
font-size: 0.75vw;
transition: text-decoration 0.3s;
}
.htext:after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 0;
left: 0;
background-color: #54B3A1;
transform-origin: center;
transition: transform 0.25s ease-out;
margin-bottom: -20px;
}
.htext:after:hover {
transform: scaleX(1);
transform-origin: center;
}
.logo1 {
margin-right: 10%;
height: 7%;
width: 8%;
}
.logo2 {
margin-right: 1.5%;
}
<div class="div1">
<header>
<img src="images/viennalogo.png" class="logo1">
<a href="#" class="htext">
<p>HOME</p>
</a>
<a href="#" class="htext">
<p>BRANDS WE WORK WITH</p>
</a>
<a href="#" class="htext">
<p>BRAND GALLERY</p>
</a>
<a href="#" class="htext">
<p>NEWS</p>
</a>
<a href="#" class="htext">
<p>ABOUT US</p>
</a>
<a href="#" class="htext">
<p>CONTACT</p>
</a>
<img src="images/Facebook.png">
<img src="images/Instagram.png">
<img src="images/Twitter.png">
</header>
</div>
well for an underline expansion, I wouldn't go with scaleX (for a lot of reasons)...
Instead, try this (I hope it's what you're looking for:
.htext {
margin-right: 3%;
font-size: 0.75vw;
transition: text-decoration 0.3s;
display: inline-block;
padding: 15px 20px;
position: relative;
}
.htext:after {
background: none repeat scroll 0 0 transparent;
bottom: 0;
content: "";
display: block;
height: 2px;
left: 50%;
position: absolute;
background: #54B3A1;
transition: width 0.3s ease 0s, left 0.3s ease 0s;
width: 0;
}
.htext:hover:after {
width: 100%;
left: 0;
}
For this to work, make sure your .htext class has a relative position, and that your .htext:after is absolute to that.

Why is overflow in css working with a delay?

I'm trying to achieve a drop down cover effect (Not sure how it's really called) with the following code:
.new_events_list {
position: absolute;
width: 26%;
height: 28vh;
background-color: #323642;
cursor: pointer;
}
#new_events_list_effect {
background-color: #ee5f95;
width: 100%;
opacity: 0.5;
top: -100%;
transition: 0.5s;
}
div.new_events_list:hover #new_events_list_effect {
top: 0%;
transition: 0.5s;
}
div.new_events_list:hover img {
filter: grayscale(0.5);
transition: 1s;
}
<div class="new_events_list" style="overflow: hidden;border-radius: 10px;">
<img class="new_events_list" id="photo1" src="https://www.dpreview.com/files/p/articles/7395606096/Google-Photos.jpeg" alt="event_list_1" style=" object-fit: cover; width: 100%;border-radius: 10px;">
<div class="new_events_list" id="new_events_list_effect">
</div>
</div>
The problem that I'm facing is that once you hover over the photo the pink block drops down with the corners visible which only disappear after a second or so. Could anyone explain to me how I could possibly drop down the pink coloured div without the corners being visible?
Thank you very much for your help in advance.
The following code should work:
.new_events_list {
position: relative;
width: 26%;
backgorund-color: black;
border-radius: 10px;
overflow: hidden;
}
.image {
width: 100%;
}
.new_events_list_effect {
position: absolute;
height: 100%;
width: 100%;
background-color: #ee5f95;
opacity: 0.5;
top: -100%;
transition: 0.5s;
border-radius: 10px;
}
.new_events_list:hover .new_events_list_effect {
top: 0%;
transition: 0.5s;
}
<div class="new_events_list">
<img src="https://www.dpreview.com/files/p/articles/7395606096/Google-Photos.jpeg" class="image">
<div class="new_events_list_effect"></div>
</div>

trouble about image slider html CSS

dudes.
have made my image slider, but the first click doesn’t trigger an animation. It just jumps to the target. I want to smoothly changing of picture, but the firs just jump.
To understand my question better, go to
http://labs.qnimate.com/slider/#slider-image-3 and pay attention to animation between images.
here is html-code:
<div class="slider-holder">
<span id="slider-image-1"></span>
<span id="slider-image-2"></span>
<span id="slider-image-3"></span>
<div class="image-holder">
<img src="images/slide1.jpg" class="slider-image" />
<img src="images/slide2.jpg" class="slider-image" />
<img src="images/slide3.jpg" class="slider-image" />
</div>
<div class="button-holder">
</div>
</div>
and here is CSS:
.slider-holder
{
width: 800px;
height: 400px;
background-color: yellow;
margin-left: auto;
margin-right: auto;
margin-top: 0px;
text-align: center;
overflow: hidden;
}
.image-holder
{
width: 2400px;
background-color: red;
height: 400px;
clear: both;
position: relative;
-webkit-transition: left 2s;
-moz-transition: left 2s;
-o-transition: left 2s;
transition: left 2s;
}
.slider-image
{
float: left;
margin: 0px;
padding: 0px;
position: relative;
}
#slider-image-1:target ~ .image-holder
{
left: 0px;
}
#slider-image-2:target ~ .image-holder
{
left: -800px;
}
#slider-image-3:target ~ .image-holder
{
left: -1600px;
}
.button-holder
{
position: relative;
top: -20px;
}
.slider-change
{
display: inline-block;
height: 10px;
width: 10px;
border-radius: 5px;
background-color: brown;
}
Is there a way to fix that?
Than for all of you for helping me.
Change this bit:
#slider-image-1:target ~ .image-holder {
left: 0px;
}
to
#slider-image-1 ~ .image-holder {
left: 0px;
}
Here is given image width and second image width added. you check your image width and change as per your images. Given demo is working correct

CSS trasition - Slide down and up

I am trying show/hide div on click, and wanted to use CSS transition, that will be like when clicked on open, it will show a div from top to bottom with sliding effect, and and when close it will slide up from bottom and hide, I attempt to create this using css transition but not working, can anybody suggest?
Here is the JSFiddle demo
$('.showdiv').click(function(){
$(".morphing_search").show();
});
$('.close-btn').click(function(){
$(".morphing_search").hide();
});
body {
background: #fff;
}
.morphing_search {
width: 100%;
height: 500px;
left: 0;
top: 20px;
background: #cdcdcd;
display: none;
transition-property: all;
transition-duration: .1s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.close-btn {
position: absolute;
right: 30px;
top: 10px;
background: #f00;
color: #fff;
padding: 5px 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<a class="showdiv" href="javascript:;">Open box</a>
<div class="morphing_search"> this is the test div </div>
<a class="close-btn" href="javascript:;">X</a>
You can't use display property when using animation/transition in css.
So, what I did is I animate the max-height.
In active state, I exaggerated the value.
$('.showdiv').click(function(){
$(".morphing_search").addClass('active');
});
$('.close-btn').click(function(){
$(".morphing_search").removeClass('active');
});
.morphing_search {
width: 100%;
height: 500px;
left: 0;
top: 20px;
background: #cdcdcd;
max-height: 0;
overflow: hidden;
transition-property: all;
transition-duration: .7s;
transition-timing-function: cubic-bezier(0, 1, 0.5, 1);
}
.morphing_search.active {
max-height: 500px; }
.close-btn {
position: absolute;
right: 30px;
top: 10px;
background: #f00;
color: #fff;
padding: 5px 10px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class="showdiv" href="javascript:;">Open box</a>
<div class="morphing_search"> this is the test div </div>
<a class="close-btn" href="javascript:;">X</a>
Using css. You need to add and remove class.
Hope it helps! Cheers!

CSS button transition stops playing

My CSS transition suddenly stops as shown in the following image
This only happens on Chrome, on Firefox everything works normally, other than that I cannot test.
The interesting thing is not only that the transition stops for no reason, but is that once I right-click on a button with this class, it works normally for the rest of the browsing session.
The following image is what the button looks like when the working transition ends:
HTML and CSS code
.main-link{
position: relative;
display: block;
overflow: hidden;
width: 200px;
height: auto;
color: #FFF;
text-align: center;
text-decoration: none;
border: 2px solid #53c1f8;
}
.main-link::after {
position: absolute;
overflow: none;
content: "";
background: #53c1f8;
left: 50%;
top: 50%;
height: 0%;
width: 100%;
z-index: -1;
transition: 0.75s ease-in-out;
transform: translateX(-50%) translateY(-50%) rotate(45deg);
}
.main-link:hover::after {
height: 15em;
}
<body>
<div id='main'>
<div id='content'>
<div id='main-image'>
<div id='main-image-intro'>
<ul id='main-image-cto'>
<li>
<a href='subscribe.html' class='main-link'> GET STARTED </a>
</li>
<li>
<a href='subscribe.html' class='main-link'> GIFT IT </a>
</li>
</ul>
</div>
</div>
</div>
</div>
</body>
Tested under Ubuntu 15.10:
Chromium 47.0.2526.73
Mozilla Firefox 43.0.4
Edit:
I completely changed my answer. Think this should work in any modern browser and be a more save option.
a.button {
color: black;
height: 50px;
width: 200px;
border: 2px solid black;
padding: 10px 30px;
text-decoration: none;
font-family: Helvetica;
position: relative;
display: inline-block;
line-height: 50px;
text-align: center;
transition: color 0.2s ease-out;
overflow: hidden;
}
a.button:after {
position: absolute;
content: '';
background-color: black;
height: 100%;
width: 1px;
left: 65%;
top: 0;
z-index: -1;
transition: transform 0.4s ease-out;
transform: skew(45deg) scale(0,1);
margin-left: -20%;
}
a.button:hover {
color: white;
}
a.button:hover:after {
width: 1px;
background-color: black;
transform: skew(45deg) scale(400, 1);
}
<a class="button" href="">Button</a>