I want a child span to overflow it's grandparents overflow:hidden rule. This is my HTML code:
<div class="ia-container">
<figure>
<img src="IMG/3.jpg" alt="image03" />
<figcaption><span>Silent Serenity</span></figcaption>
</figure>
</div>
and this id the CSS code:
.ia-container {
width: 520px;
height:420px;
margin: 12px auto;
overflow: hidden;
position:relative;
-webkit-transform: rotate(0deg);
-moz-transform: rotate(0deg);
-ms-transform: rotate(0deg);
-o-transform: rotate(0deg);
transform: rotate(0deg);
}
.ia-container figure {
position: absolute;
top: 0;
left: 92px; /* width of visible piece */
width: 335px;
}
.ia-container > figure {
position: relative;
left: 0 !important;
}
.ia-container figcaption {
width: 100%;
height: 100%;
background: rgba(87, 73, 81, 0.1);
position: absolute;
top: 0px;
-webkit-transition: all 0.2s linear;
-moz-transition: all 0.2s linear;
-o-transition: all 0.2s linear;
-ms-transition: all 0.2s linear;
transition: all 0.2s linear;
}
.ia-container figcaption span {
position: fixed;
width: 300px;
height:300px;
top: 40%;
left: -300px;
background: rgba(87, 73, 81, 0.3);
}
I need that overflow:hidden rule in my div. I want the span to overflow ia-container div, but it doesn't. I still keeps being hidden inside the div. What am I doing wrong about it? or is there a way to overcome this problem?!
This is what it looks like:
and this is what I want to have:
Related
#keyframes rightup {
0% {
transform-origin: top left;
}
5%,
30% {
transition: transform 1s ease-out;
transform-origin: top left;
transform: rotate(-20deg);
}
10%,
35% {
transition: transform 1s ease-in;
transform: translateY(-20px);
}
15%,
40% {
transition: transform 1s ease-out;
transform-origin: top right;
transform: rotate(20deg);
}
20%,
45% {
transition: transform 1s ease-in;
transform: translateY(-20px);
}
25%,
50% {
transform-origin: 0 0;
transform: translateY(0px);
}
}
body {
background-color: #82AAE3;
/*#91D8E4*/
}
.box {
position: absolute;
top: 50%;
left: 50%;
height: 100px;
width: 110px;
}
.giftbox {
position: absolute;
left: 5%;
height: 100px;
width: 100px;
border-radius: 5px;
background-color: #DC3535;
}
.lid {
position: absolute;
height: 20px;
width: 110px;
background-color: #DC3535;
border-style: solid;
border-color: black;
border-width: 0.1px;
border-radius: 5px;
animation-name: rightup;
animation-duration: 1s;
animation-iteration-count: 3;
animation-delay: 1s;
}
.ribbon-h {
position: absolute;
height: 20px;
width: 100px;
top: 40%;
left:0;
background-color: #FFE15D;
}
.ribbon-v {
position: absolute;
height: 100px;
width: 20px;
left: 40%;
top:0;
background-color: #FFE15D;
}
.box:hover {
transition: transform 400ms ease-in-out;
transform: scale(1.3);
}
.box:hover .lid {
animation:none;
transition: transform 400ms ease-in-out;
transform-origin: top left;
transform: rotate(-120deg);
}
<div class="box">
<div class="giftbox">
<div class="textmsg"><p></p></div>
<div class="ribbon-h">
</div>
<div class="ribbon-v">
</div>
</div>
<div class="lid"></div>
</div>
When hovered over while the animation is running , the transition mentioned in hover state executes instantly.
While when hovered over after the animation is done , the transition mentioned in hover state executes according to the duration specified.
tried adding play-state:paused too , but that made it even weirder.
What is the simplest CSS for animating two elements to overlay each other when their parent is hovered on?
Here are two attempts I have done, each with separate issues.
https://codepen.io/ndullea/pen/RwNaXdJ
In this one they will both move, but it is not smooth because they have different parents and the elements are also misaligned because of that.
HTML:
<div class="container">
<div class="bar"/>
</div>
<div class="container_two">
<div class="bar_two"/>
</div>
CSS:
.container {
height: 100vh;
width: 100vw;
}
.bar {
height: 100px;
background-color: #29cf7c;
width: 10px;
}
.bar_two {
height: 150px;
background-color: #eb4034;
width: 10px;
margin-left: 200px;
z-index: 1;
}
.container:hover > .bar {
transform: translateX(100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar {
transform: translate(0px, 0px);
transition: all .5s linear;
}
.container:hover > .bar_two {
transform: translateX(-100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar_two {
transform: translate(0px, 0px);
transition: all .5s linear;
}
https://codepen.io/ndullea/pen/wvBWwML
This one is smooth, but they both animate they same way (instead of going towards each other), I think because of the margin property.
HTML:
<div class="container">
<div class="bar"/>
<div class="bar_two"/>
</div>
CSS:
.container {
height: 100vh;
width: 100vw;
}
.bar {
height: 100px;
background-color: #29cf7c;
width: 10px;
}
.bar_two {
height: 150px;
background-color: #eb4034;
width: 10px;
margin-left: 200px;
z-index: 1;
}
.container:hover > .bar {
transform: translateX(100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar {
transform: translate(0px, 0px);
transition: all .5s linear;
}
.container:hover > .bar_two {
transform: translateX(-100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar_two {
transform: translate(0px, 0px);
transition: all .5s linear;
}
I have edited your second fiddle with some improvements: https://jsfiddle.net/v1m0rsfj/11/
HTML
<div class="container">
<div class="bar"></div>
<div class="bar_two"></div>
</div>
CSS
.container {
height: 100vh;
width: 100vw;
border: 2px solid #000;
}
.bar,
.bar_two {
position: absolute;
height: 100px;
background-color: #29cf7c;
width: 10px;
}
.bar {
}
.bar_two {
left: 200px;
background-color: #eb4034;
z-index: 1;
}
.container:hover > .bar {
transform: translateX(100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar {
transform: translate(0px, 0px);
transition: all .5s linear;
}
.container:hover > .bar_two {
transform: translateX(-100px);
transition: all .5s linear;
}
.container:not(:hover) > .bar_two {
transform: translate(0px, 0px);
transition: all .5s linear;
}
I found the biggest issue to be how you were closing your div tags <div /> isn't the right way to close a div tag please use <div></div>
Also I found margin-left to be mis-positioning your element hence the changes to your css
This menu in the middle of this page is working well, but on a Mac tablet (IOS system) it is giving this bug hover menu on Mac IOS. I suspect the problem to come from the "hover" function. Here is the html code :
.accueil2 {
text-align: center;
width: 70%;
}
.hover {
background-color: #fff;
}
.wrap {
position: relative;
width: 60vmin;
height: 60vmin;
margin: 0 auto;
top: -10vmin;
-webkit-transform: scale(0.2) translatez(0px);
transform: scale(0.2) translatez(0px);
opacity: 0;
-webkit-transition: opacity .5s, -webkit-transform .5s;
transition: opacity .5s, -webkit-transform .5s;
transition: transform .5s, opacity .5s;
transition: transform .5s, opacity .5s, -webkit-transform .5s;
-webkit-perspective: 800;
perspective: 800;
}
.a1,
.a2,
.a3,
.a4,
.a5 {
position: absolute;
left: 0;
top: 0;
width: 47.5%;
height: 47.5%;
overflow: hidden;
-webkit-transform: scale(.5) translateZ(0px);
transform: scale(.5) translateZ(0px);
background: #585247;
}
a .div1,
a .div2,
a .div3,
a .div4 {
height: 100%;
background-size: cover;
opacity: .5;
-webkit-transition: opacity .5s;
transition: opacity .5s;
border-radius: inherit;
}
a:nth-child(1) {
/*lien haut gauche*/
border-radius: 40vmin 0 0 0;
-webkit-transform-origin: 110% 110%;
transform-origin: 110% 110%;
-webkit-transition: -webkit-transform .4s .15s;
transition: -webkit-transform .4s .15s;
transition: transform .4s .15s;
transition: transform .4s .15s, -webkit-transform .4s .15s;
}
a:nth-child(1) div {
/*haut gauche*/
background: #E3DFD2;
}
a:nth-child(2) {
/*lien haut droite*/
border-radius: 0 40vmin 0 0;
left: 52.5%;
-webkit-transform-origin: -10% 110%;
transform-origin: -10% 110%;
-webkit-transition: -webkit-transform .4s .2s;
transition: -webkit-transform .4s .2s;
transition: transform .4s .2s;
transition: transform .4s .2s, -webkit-transform .4s .2s;
}
a:nth-child(2) div {
background: #E3DFD2;
}
a:nth-child(3) {
/*lien en bas à gauche*/
border-radius: 0 0 0 40vmin;
top: 52.5%;
-webkit-transform-origin: 110% -10%;
transform-origin: 110% -10%;
-webkit-transition: -webkit-transform .4s .25s;
transition: -webkit-transform .4s .25s;
transition: transform .4s .25s;
transition: transform .4s .25s, -webkit-transform .4s .25s;
}
a:nth-child(3) div {
background: #E3DFD2;
}
a:nth-child(4) {
/*lien en bas à droite*/
border-radius: 0 0 40vmin 0;
top: 52.5%;
left: 52.5%;
-webkit-transform-origin: -10% -10%;
transform-origin: -10% -10%;
-webkit-transition: -webkit-transform .4s .3s;
transition: -webkit-transform .4s .3s;
transition: transform .4s .3s;
transition: transform .4s .3s, -webkit-transform .4s .3s;
}
a:nth-child(4) div {
background: #E3DFD2;
}
.a5 {
/*lien centre*/
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50vmin;
box-shadow: 0 0 0 5vmin #E3DFD2;
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transition: -webkit-transform 1s;
-webkit-transform-style: preserve-3d;
}
#faceA {
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50%;
background: green;
}
#faceB {
position: absolute;
width: 55%;
height: 55%;
left: 22.5%;
top: 22.5%;
border-radius: 50%;
background: blue;
}
.a5.flipMe {
-webkit-transform: rotateY(180deg);
}
.spanout {
position: relative;
display: block;
margin: 0 auto;
top: 25vmin;
width: 10vmin;
height: 10vmin;
border-radius: 100%;
background: #585247;
-webkit-transform: translateZ(0px);
transform: translateZ(0px);
}
.spanin {
position: absolute;
width: 60%;
height: 3px;
background: #ACA696;
left: 20%;
top: 50%;
border-radius: 0;
}
.spanin:after,
.spanin:before {
content: '';
position: absolute;
left: 0;
top: -1.5vmin;
width: 100%;
height: 100%;
background: inherit;
}
.spanin:after {
top: 1.5vmin;
}
.spanout:hover+.wrap,
.wrap:hover {
-webkit-transform: scale(.8) translateZ(0px);
transform: scale(.8) translateZ(0px);
opacity: 1;
}
.spanout:hover+.wrap a,
.wrap:hover a {
-webkit-transform: scale(1) translatez(0px);
transform: scale(1) translatez(0px);
}
a:hover div {
opacity: 1;
-webkit-transform: translatez(0px);
transform: translatez(0px);
}
<div class="accueil2">
<span class="spanout">
<span class="spanin">
</span>
</span>
<div class="wrap">
<a href="#" class="a1">
<div class="div1"></div>
</a>
<a href="#" class="a2">
<div class="div2"></div>
</a>
<a href="#" class="a3">
<div class="div3"></div>
</a>
<a href="#" class="a4">
<div class="div4"></div>
</a>
<div class="a5">
<div id="faceA">A</div>
<div id="faceB">B</div>
</div>
</div>
</div>
Created a LightBox effect using pure CSS and HTML, no JS. The image appears, but on the right side of the screen, halfway cut off, and partially underneath my Nav bar. Half of the screen is shaded behind the image.
It appears like it would work, aside from it being off-center and behind the navigation. From the code at hand, is there anything that appears it could be doing this? I'd be happy to post more code if necessary. Thank you!
/*Eliminates padding, centers the thumbnail */
body,
html {
padding: 0;
margin: 0;
text-align: center;
float: left;
}
/* Styles the thumbnail */
a.lightbox img {
height: 150px;
border: 3px solid white;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
margin: 94px 20px 20px 20px;
}
/* Styles the lightbox, removes it from sight and adds the fade-in transition */
.lightbox-target {
position: fixed;
top: -100%;
width: 100%;
background: rgba(0, 0, 0, 0.7);
width: 100%;
opacity: 0;
-webkit-transition: opacity .5s ease-in-out;
-moz-transition: opacity .5s ease-in-out;
-o-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;
overflow: hidden;
clear: both;
}
/* Styles the lightbox image, centers it vertically and horizontally, adds the zoom-in transition and makes it responsive using a combination of margin and absolute positioning */
.lightbox-target img {
margin: auto;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
max-height: 0%;
max-width: 0%;
border: 3px solid white;
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
box-sizing: border-box;
-webkit-transition: .5s ease-in-out;
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
/* Styles the close link, adds the slide down transition */
a.lightbox-close {
display: block;
width: 50px;
height: 50px;
box-sizing: border-box;
background: white;
color: black;
text-decoration: none;
position: absolute;
top: -80px;
right: 0;
-webkit-transition: .5s ease-in-out;
-moz-transition: .5s ease-in-out;
-o-transition: .5s ease-in-out;
transition: .5s ease-in-out;
}
/* Provides part of the "X" to eliminate an image from the close link */
a.lightbox-close:before {
content: "";
display: block;
height: 30px;
width: 1px;
background: black;
position: absolute;
left: 26px;
top: 10px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
}
/* Provides part of the "X" to eliminate an image from the close link */
a.lightbox-close:after {
content: "";
display: block;
height: 30px;
width: 1px;
background: black;
position: absolute;
left: 26px;
top: 10px;
-webkit-transform: rotate(-45deg);
-moz-transform: rotate(-45deg);
-o-transform: rotate(-45deg);
transform: rotate(-45deg);
}
/* Uses the :target pseudo-class to perform the animations upon clicking the .lightbox-target anchor */
.lightbox-target:target {
opacity: 1;
top: 0;
bottom: 0;
}
.lightbox-target:target img {
max-height: 100%;
max-width: 100%;
}
.lightbox-target:target a.lightbox-close {
top: 0px;
}
<div id="gravel-button">
<a class="lightbox" href="#gravel-1">
<h7>Photo & Info</h7>
</a>
</div>
<div class="lightbox-target" id="gravel-1">
<img src="http://www.sbsg.com/wp-content/uploads/2010/02/58minus.jpg">
<a class="lightbox-close"></a>
</div>
Currently i am creating a website and i want to use the "new" css3 animations. It is hard to described what i've done, so i made a small example with the problem. When you hover with the mouse over the block the animation in firefox is very ugly. Furthermore the background image jitters 1px. The font gets blurry and the logo too. In IE11, Chrome its all working very fine :)
Here is the link: https://jsfiddle.net/0gk3fhnv/ or full code:
<ul id="parallelogram-box">
<li class="parallelogram">
<div class="text">Very nice descr Text! And here sec Row...</div>
<div class="logo"></div>
</li>
</ul>
.
body {
background: #eee;
}
#parallelogram-box {
list-style-type: none;
margin-left: 0px;
padding-left: 0px;
text-align: center;
}
#parallelogram-box li {
text-align: left;
position: relative;
list-style-type: none;
display: inline-block;
min-height: 400px;
min-width: 200px;
max-width: 200px;
transform: skew(-15deg);
-o-transform: skew(-15deg);
-webkit-transform: skew(-15deg);
margin: 20px;
overflow: hidden;
border-radius: 5%;
backface-visibility: hidden;
}
#parallelogram-box li:hover .text {
bottom: 0px;
transition: bottom 0.2s ease-in 0s;
-webkit-transition: bottom 0.2s ease-in 0s;
-moz-transition: bottom 0.2s ease-in 0s;
-o-transition: bottom 0.2s ease-in 0s;
}
#parallelogram-box li:hover {
transform: skew(-15deg);
-o-transform: skew(-15deg);
-webkit-transform: skew(-15deg);
}
#parallelogram-box li:before {
content: "";
position: absolute;
width:200%;
height:200%;
z-index: -1;
transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
-o-transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
-webkit-transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
}
li.parallelogram:before {
background: url(http://i65.photobucket.com/albums/h235/Ignwar/Album%20Mountains/AlaskanMonoliths.jpg);
background-position: -1000px -200px;
}
#parallelogram-box p {
font-size: 20px;
text-align: center;
}
#parallelogram-box li > * {
transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
-o-transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
-webkit-transform: skew(15deg) translateZ(0) scale(1.0, 1.0) translate3d(0,0,0);
}
.text {
background: rgba(36,36,36,.9);
color: #e9e9e9;
position: absolute;
bottom: -75px;
height: 100px;
width: 180px;
z-index: 1;
font-size: 14pt;
margin-left: -12px;
text-align: center;
padding: 10px 25px 10px 25px;
transition: bottom 0.1s ease-in 0s;
-webkit-transition: bottom 0.1s ease-in 0s;
-moz-transition: bottom 0.1s ease-in 0s;
-o-transition: bottom 0.1s ease-in 0s;
-webkit-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
}
.logo {
position: absolute;
top: 50%;
margin-top: -100px;
width: 200px;
height: 200px;
}
.parallelogram .logo {
background: url(http://www.findthatlogo.com/wp-content/uploads/2011/10/dallas-mavericks-logo.png) no-repeat;
background-size: contain;
background-position: 50% 50%;
}
Can you please tell me, whats causing this strange behavior? Is there a work around?
I've found a solution!
Look at https://jsfiddle.net/0gk3fhnv/5/
#-moz-document url-prefix() {
#parallelogram-box li:after {
content: "";
position: absolute;
width:200%;
height:200%;
z-index: -1;
transform: none !important;
}
li.parallelogram:after {
background-image: url(for_firefox_skewed_picure.png);
}
}
I changed the transition duration for firefox to 0.01 seconds and a linear animation to obscure the blurry text. Furthermore i added the css code above, which adds a exception for Firefox. The code removes the skew of the background image. So you have to add a custom background image for Firefox and skew it for your % in Photoshop or another photo editing software.