Hover css slide out for multiple objects/items - html

I am doing a website project and I would like to have this cool hover effect but I can't seem to get it to work right?
I have a vinyl record case image that slides to the left with a title (overflow:hidden) to reveal the record image behind it. At the same time from the left I want a description of the record to slid out from behind the vinly record case thats moving to the left and be on top of the record image with a little opacity so you can still see the record(this part is easy)
Here is the html code:
<div id="stations">
<div class="grid_3">
<div class="records"><!-- sleeve -->
<h3>Groove Salad</h3>
<div class="recordsinfo">Station description.</div>
</div>
</div>
</div>
and here is the css code:
#stations>div {
background-image: url(http://benlevywebdesign.com/somafm/images/SomaFMrecord.png);
background-repeat:no-repeat;
height: 220px;
margin-bottom: 20px;
position: relative;
overflow:hidden;
}
#stations>div>.records{
background-image: url(http://benlevywebdesign.com/somafm/images/SomaFM.png);
background-repeat:no-repeat;
height: 220px;
margin-bottom: 20px;
overflow:hidden;
position:relative;
}
#stations>div>.records>h3 {
color: #FFF;
background-color: rgba(255,255,255, 0.45);
width:200px;
margin-top:0px;
margin-bottom:-5px;
padding: 10px 10px 3px;
}
#stations>div>.records>.recordsinfo{
position: absolute;
left:-150px;
bottom: 0;
margin: 5px 10px;
}
#-moz-keyframes slideout {
0% { left:0; }
100% { left:-100px; }
}
#-webkit-keyframes slideout {
0% { left:0; }
100% { left:-100px; }
}
#keyframes slideout {
0% { left:0; }
100% { left:-100px; }
}
#stations>div>.records:hover{
height: 220px;
width:220%;
margin-bottom: 20px;
left:-100px;
overflow:hidden;
position: relative;
-moz-animation: slideout 0.75s 1;
-webkit-animation: slideout 0.75s 1;
animation: slideout 0.75s 1;
}
#stations>div>.records>.recordsinfo:hover{
height: 220px;
width:220%;
left:150px;
overflow:hidden;
position: relative;
-moz-animation: slidein 0.75s 1;
-webkit-animation: slidein 0.75s 1;
animation: slidein 0.75s 1;
}
and here is a fiddle of it working up until the last part which is the description not working and sliding out left!
Updated fiddle
http://jsfiddle.net/Xc9U6/11/

Try this - DEMO
HTML
<div id="stations">
<div class="grid_3">
<div class="records"><!-- sleeve -->
<h3>Groove Salad</h3>
</div>
<div class="recordsinfo">Station description.</div>
</div>
</div>
CSS
#stations > div {
background-image: url(http://benlevywebdesign.com/somafm/images/SomaFMrecord.png);
background-repeat:no-repeat;
height: 220px;
margin-bottom: 20px;
position: relative;
overflow:hidden;
}
#stations > div:hover .records {
margin-left: -110px;
}
#stations .records{
background-image: url(http://benlevywebdesign.com/somafm/images/SomaFM.png);
background-repeat:no-repeat;
height: 220px;
margin: 0 0 20px 0;
overflow:hidden;
position:relative;
-webkit-transition: all .75s;
-moz-transition: all .75s;
transition: all .75s;
}
#stations h3 {
color: #FFF;
background-color: rgba(255,255,255, 0.45);
width:200px;
margin-top:0px;
margin-bottom:-5px;
padding: 10px 10px 3px;
}
#stations > div:hover .recordsinfo {
margin-left: 0;
}
#stations .recordsinfo {
background: rgba(0, 0, 0, .8);
color: #fff;
position: absolute;
width: 150px;
bottom: 0;
margin: 5px 10px 5px -150px;
-webkit-transition: all .75s;
-moz-transition: all .75s;
transition: all .75s;
}

If I understood well you want the title to remain where it is? if so here you go:
#stations > div > .records:hover h3 {
margin-left: 100px;
}

Finally! You had lots of different issues here, from setting a width of 220%, instead of px, To trying to animate a child of an animation (so it's positions were off), to not defining the slidein animation you wanted to use.
Try this: jsFiddle

Related

How to animate/style like transition to border-bottom? [duplicate]

I'm trying to get a transition hover effect on border that the border expands on hover.
h1 {
color: #666;
}
h1:after {
position: absolute;
left: 10px;
content: '';
height: 40px;
width: 275px;
border-bottom: solid 3px #019fb6;
transition: left 250ms ease-in-out, right 250ms ease-in-out;
opacity: 0;
}
h1:hover:after {
opacity: 1;
}
<h1>CSS IS AWESOME</h1>
I've tried this on Jsfiddle
To expand the bottom border on hover, you can use transform:scaleX'(); (mdn reference) and transition it from 0 to 1 on the hover state.
Here is an example of what the border hover effect can look like :
The border and transition are set on a pseudo element to prevent transitioning the text and avoid adding markup.
To expand the bottom border from left or right, you can change the transform-origin property to the left or right of the pseudo element:
h1 { color: #666;display:inline-block; margin:0;text-transform:uppercase; }
h1:after {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1:hover:after { transform: scaleX(1); }
h1.fromRight:after{ transform-origin:100% 50%; }
h1.fromLeft:after{ transform-origin: 0% 50%; }
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
Note : You need to add vendor prefixes to maximize browser support (see canIuse).
Expand bottom border on hover with 2 lines
You can achieve this effect when the text spans on 2 lines. The before pseudo element is absolutely positioned to make underline of the first line with bottom:1.2em;:
h1 { position:relative;color: #666;display:inline-block; margin:0;text-transform:uppercase;text-align:center;line-height:1.2em; }
h1:after, h1:before {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1:before{
position:absolute;
bottom:1.2em; left:0;
width:100%;
}
.ef2:hover:after {
transition-delay:150ms;
}
h1:hover:after, h1:hover:before { transform: scaleX(1); }
<h1>Expand border<br/>on two lines</h1>
<br/>
<br/>
<h1 class="ef2">Expand border<br/>effect two</h1>
Different transition direction on hover in and out :
The point is to change the transform-origin position from one side to the other on the hover state. This way the bottom boder enters from one side on hover and exits on the other when the element isn't hovered anymore.
Here is a demo :
h1 { color: #666;display:inline-block; margin:0;text-transform:uppercase; }
h1:after {
display:block;
content: '';
border-bottom: solid 3px #019fb6;
transform: scaleX(0);
transition: transform 250ms ease-in-out;
}
h1.fromLeft:after{ transform-origin: 100% 50%; }
h1.fromRight:after{ transform-origin: 0% 50%; }
h1.fromLeft:hover:after{ transform: scaleX(1); transform-origin: 0% 50%; }
h1.fromRight:hover:after{ transform: scaleX(1); transform-origin: 100% 50%; }
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
We can do this with only background. No pseudo-element needed. This is more flexible.
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline-block;
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.3s;
margin: 5px 0;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
Multiple line animation:
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline; /* should be 'inline' for multiple line animation */
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.5s;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromLeft">Expand from <br>left with <br>multiple line</h1>
simple and lightweight version
li {
margin-bottom: 10px;
}
.cool-link {
display: inline-block;
color: #000;
text-decoration: none;
}
.cool-link::after {
content: '';
display: block;
width: 0;
height: 2px;
background: #000;
transition: width .3s;
}
.cool-link:hover::after {
width: 100%;
//transition: width .3s;
}
<ul>
<li><a class="cool-link" href="#">A cool link</a></li>
<li><a class="cool-link" href="#">A cool link</a></li>
<li><a class="cool-link" href="#">A cool link</a></li>
</ul>
I know this is an old post and it is already answered but you might like the following effect too.
<div class="cd-single-point">
<a class="cd-img-replace" href="#0"></a>
</div>
.cd-single-point {
position: absolute;
list-style-type: none;
left: 20px;
top: 20px;
}
.cd-single-point>a {
position: relative;
z-index: 2;
display: block;
width: 10px;
height: 10px;
border-radius: 50%;
background: #0079ff;
-webkit-transition: background-color 0.2s;
-moz-transition: background-color 0.2s;
-o-transition: background-color 0.2s;
transition: background-color 0.2s;
}
.cd-single-point::after {
content: '';
position: absolute;
border-radius: 50%;
width: 100%;
height: 100%;
top: 0;
left: 0;
animation: cd-pulse 2s infinite;
}
#keyframes cd-pulse
{
0% {box-shadow:0 0 0 0 #0079ff}
100%{box-shadow:0 0 0 20px rgba(255,150,44,0)}
}
DEMO
h1 {
color: #666;
display:inline-block;
margin:0;
text-transform:uppercase;
}
h1:after {
display:block;
content: '';
border-bottom: solid 3px #92a8d1;
transform: scaleX(0);
transition: transform 800ms ease-in-out;
}
h1:hover:after {
transform: scaleX(1);
}
<h1 class="fromCenter">Hover Over Me</h1><br/>
we can do using simple transition effect.
HTML
<h1>CSS IS AWESOME</h1>
CSS
h1 {
color: #666;
position: relative;
display: inline-block;
}
h1:after {
position: absolute;
left: 50%;
content: '';
height: 40px;
height: 5px;
background: #f00;
transition: all 0.5s linear;
width: 0;
bottom: 0;
}
h1:hover:after {
width: 270px;
margin-left: -135px;
}
Link to Fiddle
h1 {
/* you can change these variables to control the border */
--border-color: purple;
--border-width: 5px;
--bottom-distance: 0px; /* you can increase this */
color: #666;
display: inline-block;
background-image: linear-gradient(var(--border-color), var(--border-color));
background-size: 0% var(--border-width);
background-repeat: no-repeat;
transition: background-size 0.3s;
margin: 5px 0;
}
.fromCenter {
background-position: 50% calc(100% - var(--bottom-distance));
}
.fromRight {
background-position: 100% calc(100% - var(--bottom-distance));
}
.fromLeft {
background-position: 0 calc(100% - var(--bottom-distance))
}
h1:hover {
background-size: 100% var(--border-width);
}
<h1 class="fromCenter">Expand from center</h1><br/>
<h1 class="fromRight">Expand from right</h1><br/>
<h1 class="fromLeft">Expand from left</h1>
transition: all 1000ms ease-in-out;
Demo
or are you looking for this
Demo2
h1 {
color: #666;
}
h1:after {
position: absolute;
left: 10px;
content: '';
height: 40px;
width: 275px;
border-bottom: solid 3px #019fb6;
transition: all 550ms ease-in-out;
border-bottom-width: 0px;
}
h1:hover:after {
border-bottom-width: 5px;
}
<h1>CSS IS AWESOME</h1>

How to change the position of a button?

I have a question. I wanted to use a button from codepen.io on my website (this one: https://codepen.io/emared/pen/RYgbaJ/). Everything works with the button but it appears on the end of my website. I want it to be just below my text. Here's my code:
<h3 style="padding-top: 35;">
Text</h3>
<div id="wrapper">
<a href="#" class="my-super-cool-btn">
<div class="dots-container">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
<span>Go!</span>
</a>
</div>
And in my CSS-Document I just pasted everything from the codepen page.
Now this is what it looks like: https://ibb.co/G3cmGdQ
Why's there that huge space between "Text" and the button?
Thanks for your help! 🙏
Look at the following code:
#import url('https://fonts.googleapis.com/css?family=Montserrat:900');
body{
margin:0;
padding:0;
background-color:#292929;
font-family: 'Montserrat', sans-serif;
}
.heading {
text-align: center;
margin-top: 50px;
color: #fff;
}
#wrapper{
margin-bottom: 30px;
width:100vw;
height:100vh;
box-sizing:border-box;
display:flex;
align-items:center;
justify-content:center;
}
.my-super-cool-btn{
position:relative;
text-decoration:none;
color:#fff;
letter-spacing:1px;
font-size:2rem;
box-sizing:border-box;
}
.my-super-cool-btn span{
position:relative;
box-sizing:border-box;
display:flex;
align-items:center;
justify-content:center;
width:200px;
height:200px;
}
.my-super-cool-btn span:before{
content:'';
width:100%;
height:100%;
display:block;
position:absolute;
border-radius:100%;
border:7px solid #F3CF14;
box-sizing:border-box;
transition: all .85s cubic-bezier(0.25, 1, 0.33, 1);
box-shadow: 0 30px 85px rgba(0,0,0,0.14), 0 15px 35px rgba(0,0,0,0.14);
}
.my-super-cool-btn:hover span:before{
transform:scale(0.8);
box-shadow: 0 20px 55px rgba(0,0,0,0.14), 0 15px 35px rgba(0,0,0,0.14);
}
.my-super-cool-btn .dots-container{
opacity:0;
animation: intro 1.6s;
animation-fill-mode: forwards;
}
.my-super-cool-btn .dot{
width:8px;
height:8px;
display:block;
background-color:#F3CF14;
border-radius:100%;
position:absolute;
transition: all .85s cubic-bezier(0.25, 1, 0.33, 1);
}
.my-super-cool-btn .dot:nth-child(1){
top:50px;
left:50px;
transform:rotate(-140deg);
animation: swag1-out 0.3s;
animation-fill-mode: forwards;
opacity:0;
}
.my-super-cool-btn .dot:nth-child(2){
top:50px;
right:50px;
transform:rotate(140deg);
animation: swag2-out 0.3s;
animation-fill-mode: forwards;
opacity:0;
}
.my-super-cool-btn .dot:nth-child(3){
bottom:50px;
left:50px;
transform:rotate(140deg);
animation: swag3-out 0.3s;
animation-fill-mode: forwards;
opacity:0;
}
.my-super-cool-btn .dot:nth-child(4){
bottom:50px;
right:50px;
transform:rotate(-140deg);
animation: swag4-out 0.3s;
animation-fill-mode: forwards;
opacity:0;
}
.my-super-cool-btn:hover .dot:nth-child(1){
animation: swag1 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(2){
animation: swag2 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(3){
animation: swag3 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(4){
animation: swag4 0.3s;
animation-fill-mode: forwards;
}
#keyframes intro {
0% {
opacity:0;
}
100% {
opacity:1;
}
}
#keyframes swag1 {
0% {
top:50px;
left:50px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
top:20px;
left:20px;
width:8px;
opacity:1;
}
}
#keyframes swag1-out {
0% {
top:20px;
left:20px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
top:50px;
left:50px;
width:8px;
opacity:0;
}
}
#keyframes swag2 {
0% {
top:50px;
right:50px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
top:20px;
right:20px;
width:8px;
opacity:1;
}
}
#keyframes swag2-out {
0% {
top:20px;
right:20px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
top:50px;
right:50px;
width:8px;
opacity:0;
}
}
#keyframes swag3 {
0% {
bottom:50px;
left:50px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
bottom:20px;
left:20px;
width:8px;
opacity:1;
}
}
#keyframes swag3-out {
0% {
bottom:20px;
left:20px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
bottom:50px;
left:50px;
width:8px;
opacity:0;
}
}
#keyframes swag4 {
0% {
bottom:50px;
right:50px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
bottom:20px;
right:20px;
width:8px;
opacity:1;
}
}
#keyframes swag4-out {
0% {
bottom:20px;
right:20px;
width:8px;
}
50% {
width:30px;
opacity:1;
}
100% {
bottom:50px;
right:50px;
width:8px;
opacity:0;
}
}
<h3 class="heading">Text goes here</h3>
<div id="wrapper">
<a href="#" class="my-super-cool-btn">
<div class="dots-container">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
<span>Go!</span>
</a>
</div>
Please check the code below:
#import url("https://fonts.googleapis.com/css?family=Montserrat:900");
body {
margin: 0;
padding: 0;
background-color: #292929;
font-family: "Montserrat", sans-serif;
}
.title {
text-align: center;
color: #fff;
font-size: 50px;
padding-top: 35px;
margin: 0;
}
#wrapper {
margin-bottom: 30px;
width: 100vw;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
}
.my-super-cool-btn {
position: relative;
text-decoration: none;
color: #fff;
letter-spacing: 1px;
font-size: 2rem;
box-sizing: border-box;
}
.my-super-cool-btn span {
position: relative;
box-sizing: border-box;
display: flex;
align-items: center;
justify-content: center;
width: 200px;
height: 200px;
}
.my-super-cool-btn span:before {
content: "";
width: 100%;
height: 100%;
display: block;
position: absolute;
border-radius: 100%;
border: 7px solid #f3cf14;
box-sizing: border-box;
transition: all 0.85s cubic-bezier(0.25, 1, 0.33, 1);
box-shadow: 0 30px 85px rgba(0, 0, 0, 0.14), 0 15px 35px rgba(0, 0, 0, 0.14);
}
.my-super-cool-btn:hover span:before {
transform: scale(0.8);
box-shadow: 0 20px 55px rgba(0, 0, 0, 0.14), 0 15px 35px rgba(0, 0, 0, 0.14);
}
.my-super-cool-btn .dots-container {
opacity: 0;
animation: intro 1.6s;
animation-fill-mode: forwards;
}
.my-super-cool-btn .dot {
width: 8px;
height: 8px;
display: block;
background-color: #f3cf14;
border-radius: 100%;
position: absolute;
transition: all 0.85s cubic-bezier(0.25, 1, 0.33, 1);
}
.my-super-cool-btn .dot:nth-child(1) {
top: 50px;
left: 50px;
transform: rotate(-140deg);
animation: swag1-out 0.3s;
animation-fill-mode: forwards;
opacity: 0;
}
.my-super-cool-btn .dot:nth-child(2) {
top: 50px;
right: 50px;
transform: rotate(140deg);
animation: swag2-out 0.3s;
animation-fill-mode: forwards;
opacity: 0;
}
.my-super-cool-btn .dot:nth-child(3) {
bottom: 50px;
left: 50px;
transform: rotate(140deg);
animation: swag3-out 0.3s;
animation-fill-mode: forwards;
opacity: 0;
}
.my-super-cool-btn .dot:nth-child(4) {
bottom: 50px;
right: 50px;
transform: rotate(-140deg);
animation: swag4-out 0.3s;
animation-fill-mode: forwards;
opacity: 0;
}
.my-super-cool-btn:hover .dot:nth-child(1) {
animation: swag1 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(2) {
animation: swag2 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(3) {
animation: swag3 0.3s;
animation-fill-mode: forwards;
}
.my-super-cool-btn:hover .dot:nth-child(4) {
animation: swag4 0.3s;
animation-fill-mode: forwards;
}
#keyframes intro {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes swag1 {
0% {
top: 50px;
left: 50px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
top: 20px;
left: 20px;
width: 8px;
opacity: 1;
}
}
#keyframes swag1-out {
0% {
top: 20px;
left: 20px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
top: 50px;
left: 50px;
width: 8px;
opacity: 0;
}
}
#keyframes swag2 {
0% {
top: 50px;
right: 50px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
top: 20px;
right: 20px;
width: 8px;
opacity: 1;
}
}
#keyframes swag2-out {
0% {
top: 20px;
right: 20px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
top: 50px;
right: 50px;
width: 8px;
opacity: 0;
}
}
#keyframes swag3 {
0% {
bottom: 50px;
left: 50px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
bottom: 20px;
left: 20px;
width: 8px;
opacity: 1;
}
}
#keyframes swag3-out {
0% {
bottom: 20px;
left: 20px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
bottom: 50px;
left: 50px;
width: 8px;
opacity: 0;
}
}
#keyframes swag4 {
0% {
bottom: 50px;
right: 50px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
bottom: 20px;
right: 20px;
width: 8px;
opacity: 1;
}
}
#keyframes swag4-out {
0% {
bottom: 20px;
right: 20px;
width: 8px;
}
50% {
width: 30px;
opacity: 1;
}
100% {
bottom: 50px;
right: 50px;
width: 8px;
opacity: 0;
}
}
<h3 class="title">Text</h3>
<div id="wrapper">
<a href="#" class="my-super-cool-btn">
<div class="dots-container">
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
<div class="dot"></div>
</div>
<span>Go!</span>
</a>
</div>

Mouse over on button, another div or HTML tag will side out to the left of the button

Hi I have a problem trying to getting the animation at the left hand side of the button when user mouse over the button. One of the example that explain as below:
HTML:
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
CSS:
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
background: #00aced; margin-top:-48px; padding: 15px; display: block; color: #fff; text-decoration: none;
position: relative; z-index:1;
transition: all 250ms ease;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
margin-right: 0;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
0% { margin-top: 0; }
15% { margin-top: 0; transform: rotateX(-50deg); }
30% { margin-top: 0; transform: rotateX(50deg); }
45% { margin-top: 0; transform: rotateX(-30deg); }
60% { margin-top: 0; transform: rotateX(30deg); }
75% { margin-top: 0; transform: rotateX(-30deg); }
100% { margin-top: 0; transform: rotateX(0deg);}
}
https://jsfiddle.net/9dwk8vzg/
Original link:http://dabblet.com/gist/5559193
But for this example is at the bottom instated of at the left hand side of the button, I tried using margin-right and padding-left still unable to get the mouse over appeal div tag to be on the right hand side, may I know what do I miss to get the div tag to appeal on the right hand side/
/**
* CSS3 balancing hover effect
* Read the tutorial here: http://webbb.be/blog/little-css3-3d-hover-effects/
*/
body {background: #f06;background: linear-gradient(45deg, #f06, yellow);min-height: 100%;}
.block {
width: 150px; color: #fff; margin: 30px auto; text-transform: uppercase; text-align: center; font-family: Helvetica;
position: relative;
perspective: 350;
}
.block .normal {
width: 100%;
background: gray; padding: 15px; cursor: pointer;
position:relative; z-index:2;
}
.block .hover {
width: 100%;
background: #00aced;
padding: 15px;
display: block;
position:absolute;
color: #fff;
text-decoration: none;
z-index:1;
transition: all 250ms ease;
right: -30px;
top: 0;
}
.block:hover .normal {
background: #0084b4;
}
.block:hover .hover {
right: 100%;
transform-origin: top;
/*
animation-name: balance;
animation-duration: 1.5s;
animation-timing-function: ease-in-out;
animation-delay: 110ms;
animation-iteration-count: 1;
animation-direction: alternate;
*/
animation: balance 1.5s ease-in-out 110ms 1 alternate;
}
#keyframes balance {
15% { width: 95%; }
30% { width: 105%; }
45% { width: 97%; }
60% { width: 103%; }
75% { width: 97%; }
100% { width: 100%; }
}
<div class="block">
<div class="normal">
<span>Follow me...</span>
</div>
<a target="_BLANK" class="hover" href="http://twitter.com/benoitboucart" title="My twitter profile">
on Twitter
</a>
</div>

div button to slide in and off screen (depending user's mouse)

I have a div with class .side-buttons. This div will slide in and off when user's mouse hover over the div. I was wondering how can I hide the div completely and say when the user's mouse is in the area it would slide in?
I tried getting the off the screen but that wouldn't work as it would only work when my mouse on the div
This is my website - http://smati.ca/test/index.html (Don't click continue but instead click around the popup modal to get off the modal overlay. There you can see the div in action)
Here's my css code :
.side-buttons {
position: absolute;
right: -100px;
top: 55%;
-webkit-transition: all .4s ease-in-out;
-moz-transition: all .4s ease-in-out;
-ms-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.side-buttons:hover {
right: 0px;
}
.side-buttons a {
display: block;
background: linear-gradient(to bottom, #33a9c3 15%, #b1ccbb 100%);
border-radius: 0;
box-shadow: none;
border: none;
color: #f5f5f5;
font-size: 22px;
font-family: "Lato", sans-serif;
}
.side-buttons a small {
font-size: 16px;
}
.side-buttons a:hover,
.side-buttons a:focus,
.side-buttons a:active {
background: linear-gradient(to bottom, #33a9c3 15%, #b1ccbb 100%);
color: #f5f5f5;
}
.side-buttons a:nth-child(2) {
background: linear-gradient(to left, #de3c88 15%, #f0a473 100%);
}
You could try something like this too i.e wrapping it by a div and performing that slide-in and slide-out effect on child div as below,
#bx{
width:210px;
height:120px;
position:absolute;
top:40%;
right:0;
overflow:hidden;
border:1px solid rgba(0,0,0,0.1);
}
#bx > .b{
position:absolute;
width:200px;
height:120px;
background:blue;
right:-200px;
transition:0.6s ease;
}
#bx:hover > .b{
right:0px;
}
<div id="bx">
<div class="b">
</div>
</div>
You can use a pseudo element, like this
html, body {
margin: 0;
}
div {
position: absolute;
width: 0;
right: 0;
height: 150px;
background: red;
transition: width 0.5s;
}
div::after {
content: '';
position: absolute;
width: 30px;
right: 100%;
height: 100%;
transition: width 0s 0.5s;
border: 1px dotted gray; /* added for demo purpose */
}
div:hover {
width: 100px;
transition: width 0.5s;
}
div:hover::after {
width: 0;
transition: width 0.5s;
}
<div>
</div>
Here is another option, that might be easier to add to your existing solution
html, body {
margin: 0;
}
.content {
width: 170px;
padding: 50px 30px;
background: lightgray;
}
.wrapper {
position: absolute;
right: 0;
width: 0;
padding-left: 30px;
overflow: hidden;
transition: width 0.5s, padding-left 0s 0.5s;
border: 1px dotted gray; /* added for demo purpose */
}
.wrapper:hover {
width: 200px;
padding-left: 0;
transition: width 0.5s, padding-left 0.5s;
}
<div class="wrapper">
<div class="content">
Some text and/or images<br>
or anything else needed
</div>
</div>

Prevent circular buttons clickable outside circle in Firefox

In Firefox the clickable area of my circular buttons seems to extend outside of the circle in the shape of a square. This does not happen in Chrome/Safari, which display everything properly.
There's a "rotate on hover" feature over the buttons and this glitch is especially evident when hovering diagonally over the bottom left/right corner of the buttons and moving to the center. Anyone have any idea how to fix this?
Test-site: http://parkerrichard.com/new/index.html
HTML
<nav class="centered" role="navigation">
<div class="container">
<div class="centered">
<ul>
<li>
<button class="design"></button>
</li>
<li>
<button class="photo"></button>
</li>
<li>
<button class="music"></button>
</li>
<li>
<button class="art"></button>
</li>
<li>
<button class="parker"></button>
</li>
</ul>
</div>
</div><!--/container -->
</nav><!--/navbar -->
CSS
nav {
margin-top: 20px;
margin-bottom: 80px;
}
nav ul {
list-style: none;
margin: 10px 0 0 -30px;
}
nav li a {
font-size: 25px;
}
nav button {
width: 100%;
opacity: .1;
transition: opacity .7s ease-out;
-moz-transition: opacity .7s ease-out;
-webkit-transition: opacity .7s ease-out;
-o-transition: opacity .7s ease-out;
}
nav button:hover {
opacity: .5;
}
.art:hover, .music:hover, .photo:hover, .design:hover {
-webkit-animation:spin 2s ease;
-moz-animation:spin 2s ease;
animation:spin 2s ease;
}
#-moz-keyframes spin { 10% { -moz-transform: rotate(18deg); } }
#-webkit-keyframes spin { 10% { -webkit-transform: rotate(18deg); } }
#keyframes spin { 10% { -webkit-transform: rotate(18deg); transform:rotate(18deg); } }
nav button {
border-radius:50%;
position: absolute;
opacity: 50% !important;
left: 50%;
right: 50%;
}
.parker {
margin-top: 196px;
margin-left: -100px;
width: 200px;
height: 200px;
background: transparent url('../img/parker.jpg');
background-size: 100%;
opacity: 1 !important;
}
.art {
margin-top: 144px;
margin-left: -150px;
width: 300px;
height: 300px;
background: transparent url('../img/art.jpg');
}
.music {
margin-top: 96px;
margin-left: -198px;
width: 400px;
height: 400px;
background: transparent url('../img/music.jpg');
}
.photo {
margin-top: 48px;
margin-left: -248px;
width: 500px;
height: 500px;
background: transparent url('../img/photo.jpg');
}
.design {
margin-left: -296px;
width: 600px;
height: 600px;
background: transparent url('../img/design.jpg');
}
Firefox seems to have a problem with border-radius on button elements (something which was a problem in webkit browsers in the past aswell, see: Button border radius and cursor). This will probably get fixed in a future version, but I would suggest using divs instead.
The following should work (here also a codepen):
nav {
margin-top: 20px;
margin-bottom: 80px;
}
nav ul {
list-style: none;
margin: 10px 0 0 -30px;
}
nav li a {
font-size: 25px;
}
nav li div {
width: 100%;
opacity: .1;
transition: opacity .7s ease-out;
-moz-transition: opacity .7s ease-out;
-webkit-transition: opacity .7s ease-out;
-o-transition: opacity .7s ease-out;
}
nav li div:hover {
opacity: .5;
}
.art:hover, .music:hover, .photo:hover, .design:hover {
-webkit-animation:spin 2s ease;
-moz-animation:spin 2s ease;
animation:spin 2s ease;
}
#-moz-keyframes spin { 10% { -moz-transform: rotate(18deg); } }
#-webkit-keyframes spin { 10% { -webkit-transform: rotate(18deg); } }
#keyframes spin { 10% { -webkit-transform: rotate(18deg); transform:rotate(18deg); } }
nav li div {
border-radius:50%;
position: absolute;
opacity: 50% !important;
left: 50%;
right: 50%;
}
.parker {
margin-top: 196px;
margin-left: -100px;
width: 200px;
height: 200px;
background: transparent url('http://parkerrichard.com/new/img/parker.jpg');
background-size: 100%;
opacity: 1 !important;
}
.art {
margin-top: 144px;
margin-left: -150px;
width: 300px;
height: 300px;
background: transparent url('http://parkerrichard.com/new/img/art.jpg');
}
.music {
margin-top: 96px;
margin-left: -198px;
width: 400px;
height: 400px;
background: transparent url('http://parkerrichard.com/new/img/music.jpg');
}
.photo {
margin-top: 48px;
margin-left: -248px;
width: 500px;
height: 500px;
background: transparent url('http://parkerrichard.com/new/img/photo.jpg');
}
.design {
margin-left: -296px;
width: 600px;
height: 600px;
background: transparent url('http://parkerrichard.com/new/img/design.jpg');
}
<nav class="centered" role="navigation">
<div class="container">
<div class="centered">
<ul>
<li>
<div class="design"></div>
</li>
<li>
<div class="photo"></div>
</li>
<li>
<div class="music"></div>
</li>
<li>
<div class="art"></div>
</li>
<li>
<div class="parker"></div>
</li>
</ul>
</div>
</div><!--/container -->
</nav><!--/navbar -->