JSFiddle.
This is the HTML:
<div class='slide-show'>
<div class='single-slide'>
<img src='http://res2.windows.microsoft.com/resbox/en/windows/main/b865a018-7479-47d2-b80c-2ec8fd85c0c8_4.jpg' alt=''>
<div class='content'>
<div class='title'>Lorem ipsum</div>
<div class='description'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed diam dolor, fermentum quis orci laoreet, efficitur sodales libero. Duis accumsan malesuada risus quis pretium.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/1a212f38-ae12-4052-b462-d452be7f7de9_4.jpg' alt=''>
<div class='content'>
<div class='title'>Vestibulum porta neque</div>
<div class='description'>Vestibulum porta neque dui, sed varius massa dignissim id. Vestibulum congue gravida urna ac egestas. Sed urna lectus, condimentum at nisi et, vestibulum porttitor enim. Morbi ex felis, malesuada quis eleifend sed, consequat in velit. Nunc lacinia nec erat ut efficitur.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res2.windows.microsoft.com/resbox/en/windows/main/d47c2741-a8d8-4d78-888b-93b54e6d0be2_4.jpg' alt=''>
<div class='content'>
<div class='title'>Pellentesque habitant</div>
<div class='description'>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nisi magna, vehicula nec velit vel, porttitor ullamcorper sem. Donec porttitor ipsum sit amet convallis ornare. Ut vitae eros ante. </div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/6393c5ce-2ac6-4480-9446-7cb3c5aaafff_4.jpg' alt=''>
<div class='content'>
<div class='title'>Phasellus ac aliquam lectus</div>
<div class='description'>Phasellus ac aliquam lectus, eget posuere odio. Morbi et mattis urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/d85b86ab-92ad-4615-97e7-10836d36c350_4.jpg' alt=''>
<div class='content'>
<div class='title'>Aliquam eget lorem</div>
<div class='description'>Aliquam eget lorem ac justo tempor tempor at ut dolor. Vivamus pharetra cursus ex nec rutrum. Ut euismod justo urna, id feugiat dui lobortis sagittis. </div>
</div>
</div>
</div>
and this is the CSS:
.slide-show {
position: relative;
width: 480px;
height: 300px;
}
.single-slide {
position: absolute;
width: 100%;
height: 100%;
}
.single-slide img {
position: absolute;
width: 100%;
height: 100%;
}
.single-slide .title,
.single-slide .description {
box-sizing: border-box;
-webkit-box-sizing: border-box;
background-color: white;
background-color: rgba(255, 255, 255, 0.6);
color: black;
mix-blend-mode: luminosity;
font-family: serif;
font-size: 1.2em;
width: 100%;
padding: 0.5em 1em;
}
.single-slide .description {
height: 0;
padding-top: 0;
padding-bottom: 0;
font-size: 1em;
transition: 0.2s linear;
-webkit-transition: 0.2s linear;
overflow: hidden;
}
.slide-show .content {
position: absolute;
width: 100%;
bottom: 0;
left: 0;
}
.slide-show:hover .description {
height: auto;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.slide-show:hover .single-slide {
animation-play-state: paused;
-webkit-animation-play-state: paused;
}
.slide-show .single-slide {
animation: slideshow 10s infinite running;
-webkit-animation: slideshow 10s infinite running;
}
.slide-show .single-slide:nth-child(1) {
animation-delay: 8s;
-webkit-animation-delay: 8s;
}
.slide-show .single-slide:nth-child(2) {
animation-delay: 6s;
-webkit-animation-delay: 6s;
}
.slide-show .single-slide:nth-child(3) {
animation-delay: 4s;
-webkit-animation-delay: 4s;
}
.slide-show .single-slide:nth-child(4) {
animation-delay: 2s;
-webkit-animation-delay: 2s;
}
.slide-show .single-slide:nth-child(5) {
animation-delay: 0s;
-webkit-animation-delay: 0s;
}
#keyframes slideshow {
5%, 20% {
opacity: 1;
}
0%,
25%,
100% {
opacity: 0;
}
}
#-webkit-keyframes slideshow {
5%, 20% {
opacity: 1;
}
0%,
25%,
100% {
opacity: 0;
}
}
The code works fine in Firefox(Version 42.0 on Ubuntu 14.04 LTS 64-bit), but it looks weird in Chrome (Version 47.0.2526.73 (64-bit)). The animation only does one loop (10s), then disappears. When I hover over it, it shows up again, then disappears again after 2s.
How can I fix my code?
This issue is related to the mix-blend-mode property. It seems like Chrome doesn't fully like it, and it fails (maybe a bug?) when it processes it (even when according to caniuse.com it is supported in Chrome).
If you remove it, the animation works fine both in Chrome and Firefox. You can see it on this demo (and on your JSFiddle):
/* no script fallback
** make the picture slide internally
** but the user can't control them
*/
.slide-show {
position: relative;
width: 480px;
height: 300px;
}
.single-slide {
position: absolute;
width: 100%;
height: 100%;
}
.single-slide img {
position: absolute;
width: 100%;
height: 100%;
}
.single-slide .title, .single-slide .description {
box-sizing: border-box;
-webkit-box-sizing: border-box;
background-color: white;
background-color: rgba(255, 255, 255, 0.6);
color: black;
font-family: serif;
font-size: 1.2em;
width: 100%;
padding: 0.5em 1em;
/*mix-blend-mode: luminosity;*/
}
.single-slide .description {
height: 0;
padding-top: 0;
padding-bottom: 0;
font-size: 1em;
transition: 0.2s linear;
-webkit-transition: 0.2s linear;
overflow: hidden;
}
.slide-show .content {
position: absolute;
width: 100%;
bottom: 0;
left: 0;
}
.slide-show:hover .description {
height: auto;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
.slide-show:hover .single-slide {
animation-play-state: paused;
-webkit-animation-play-state: paused;
}
.slide-show .single-slide {
animation: slideshow 10s infinite running;
-webkit-animation: slideshow 10s infinite running;
}
.slide-show .single-slide:nth-child(1) {
animation-delay: 8s;
-webkit-animation-delay: 8s;
}
.slide-show .single-slide:nth-child(2) {
animation-delay: 6s;
-webkit-animation-delay: 6s;
}
.slide-show .single-slide:nth-child(3) {
animation-delay: 4s;
-webkit-animation-delay: 4s;
}
.slide-show .single-slide:nth-child(4) {
animation-delay: 2s;
-webkit-animation-delay: 2s;
}
.slide-show .single-slide:nth-child(5) {
animation-delay: 0s;
-webkit-animation-delay: 0s;
}
#keyframes slideshow {
5%, 20% {
opacity:1;
}
0%, 25%, 100% {
opacity:0;
}
}
#-webkit-keyframes slideshow {
5%, 20% {
opacity:1;
}
0%, 25%, 100% {
opacity:0;
}
}
<div class='slide-show'>
<div class='single-slide'>
<img src='http://res2.windows.microsoft.com/resbox/en/windows/main/b865a018-7479-47d2-b80c-2ec8fd85c0c8_4.jpg' alt=''>
<div class='content'>
<div class='title'>Lorem ipsum</div>
<div class='description'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed diam dolor, fermentum quis orci laoreet, efficitur sodales libero. Duis accumsan malesuada risus quis pretium.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/1a212f38-ae12-4052-b462-d452be7f7de9_4.jpg' alt=''>
<div class='content'>
<div class='title'>Vestibulum porta neque</div>
<div class='description'>Vestibulum porta neque dui, sed varius massa dignissim id. Vestibulum congue gravida urna ac egestas. Sed urna lectus, condimentum at nisi et, vestibulum porttitor enim. Morbi ex felis, malesuada quis eleifend sed, consequat in velit. Nunc lacinia nec erat ut efficitur.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res2.windows.microsoft.com/resbox/en/windows/main/d47c2741-a8d8-4d78-888b-93b54e6d0be2_4.jpg' alt=''>
<div class='content'>
<div class='title'>Pellentesque habitant</div>
<div class='description'>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nisi magna, vehicula nec velit vel, porttitor ullamcorper sem. Donec porttitor ipsum sit amet convallis ornare. Ut vitae eros ante. </div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/6393c5ce-2ac6-4480-9446-7cb3c5aaafff_4.jpg' alt=''>
<div class='content'>
<div class='title'>Phasellus ac aliquam lectus</div>
<div class='description'>Phasellus ac aliquam lectus, eget posuere odio. Morbi et mattis urna. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</div>
</div>
</div>
<div class='single-slide'>
<img src='http://res1.windows.microsoft.com/resbox/en/windows/main/d85b86ab-92ad-4615-97e7-10836d36c350_4.jpg' alt=''>
<div class='content'>
<div class='title'>Aliquam eget lorem</div>
<div class='description'>Aliquam eget lorem ac justo tempor tempor at ut dolor. Vivamus pharetra cursus ex nec rutrum. Ut euismod justo urna, id feugiat dui lobortis sagittis. </div>
</div>
</div>
</div>
It's missing the others syntaxes like:
animation-delay: 0s;
-webkit-animation-delay: 0s;
-moz-animation-delay: 0s;
-o-animation-delay: 0s;
and
animation: slideshow 10s infinite running;
-webkit-animation: slideshow 10s infinite running;
-moz-animation: slideshow 10s infinite running;
-o-animation: slideshow 10s infinite running;
Related
This question already has answers here:
How to overlay one div over another div
(9 answers)
Closed 2 years ago.
I've made a cool html page (with CSS, of course) that creates like a space animated background. Now, I know this might sound like a stupid question, but how do I put text on top of it?
The html is as follows:
<div class="background-container">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/moon2.png" alt="">
<div class="stars"></div>
<div class="twinkling"></div>
<div class="clouds"></div>
<div>
<h1>HEADER 1</h1>
</div>
</div>
Can I do it if I take HEADER 1 out of the div?
<h1>HEADER 1</H1> is what I'm trying to get to be shown on top of the other things (stars, twinkling, clouds, etc) but I'm not really sure how to do it.
Can anyone please help? Thanks.
Here's the full code (open in a larger window):
<!DOCTYPE html>
<style>
#keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-webkit-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-moz-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-webkit-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
.background-container{
position: fixed;
top: 0;
left:0;
bottom: 0;
right: 0;
}
.stars {
background: black url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/stars.png) repeat;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: block;
z-index: 0;
}
.twinkling{
width:10000px;
height: 100%;
background: transparent url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/twinkling.png") repeat;
background-size: 1000px 1000px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
z-index: 2;
-moz-animation:move-background 70s linear infinite;
-ms-animation:move-background 70s linear infinite;
-o-animation:move-background 70s linear infinite;
-webkit-animation:move-background 70s linear infinite;
animation:move-background 70s linear infinite;
}
.clouds{
width:10000px;
height: 100%;
background: transparent url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/clouds_repeat.png") repeat;
background-size: 1000px 1000px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
z-index: 3;
-moz-animation:move-background 150s linear infinite;
-ms-animation:move-background 150s linear infinite;
-o-animation:move-background 150s linear infinite;
-webkit-animation:move-background 150s linear infinite;
animation:move-background 150s linear infinite;
}
img{
height: 70vh;
width:70vh;
position: absolute;
z-index: 3;
right: 20px;
}
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>
<div class="background-container">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/moon2.png" alt="">
<div class="stars"></div>
<div class="twinkling"></div>
<div class="clouds"></div>
<div class="centered">
<h1>HEADER 1</h1>
</div>
</div>
</html>
I would use position absolute and apply a z-index to layer the h1 above the background. You can then offset the position relative to the container.
#keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-webkit-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-moz-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
#-webkit-keyframes move-background {
from {
-webkit-transform: translate3d(0px, 0px, 0px);
}
to {
-webkit-transform: translate3d(1000px, 0px, 0px);
}
}
.background-container {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
}
.stars {
background: black url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/stars.png) repeat;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
display: block;
z-index: 0;
}
.twinkling {
width: 10000px;
height: 100%;
background: transparent url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/twinkling.png") repeat;
background-size: 1000px 1000px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
z-index: 2;
-moz-animation: move-background 70s linear infinite;
-ms-animation: move-background 70s linear infinite;
-o-animation: move-background 70s linear infinite;
-webkit-animation: move-background 70s linear infinite;
animation: move-background 70s linear infinite;
}
.clouds {
width: 10000px;
height: 100%;
background: transparent url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/clouds_repeat.png") repeat;
background-size: 1000px 1000px;
position: absolute;
right: 0;
top: 0;
bottom: 0;
z-index: 3;
-moz-animation: move-background 150s linear infinite;
-ms-animation: move-background 150s linear infinite;
-o-animation: move-background 150s linear infinite;
-webkit-animation: move-background 150s linear infinite;
animation: move-background 150s linear infinite;
}
img {
height: 70vh;
width: 70vh;
position: absolute;
z-index: 3;
right: 20px;
}
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.content {
position: absolute;
top: 0;
left: 0;
color: #fff;
padding: 10px;
z-index: 10;
}
<div class="background-container">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/1231630/moon2.png" alt="">
<div class="stars"></div>
<div class="twinkling"></div>
<div class="clouds"></div>
</div>
<div class="content">
<h1>HEADER 1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ex leo, lobortis eget libero in, venenatis tincidunt ipsum. Nulla ultrices purus in ornare ultricies. In et faucibus justo. Nunc in tempus diam, nec facilisis eros. Quisque non quam id mi rutrum volutpat vel ac purus. Suspendisse potenti. Etiam non orci porttitor, lacinia magna eget, imperdiet ex. Pellentesque bibendum ligula vel elit tincidunt, quis aliquam nisl consequat. Pellentesque facilisis lectus ac orci commodo, ac cursus nibh mollis. Nunc turpis ipsum, laoreet sit amet odio sit amet, aliquam dignissim nisi. Suspendisse potenti.</p>
<p>Nullam at sodales urna, quis pellentesque lectus. Aenean a augue consequat, viverra libero ut, varius ex. Duis id ipsum sed risus aliquet consectetur. Aliquam facilisis nunc quis purus rutrum lobortis. Praesent mollis tincidunt quam at molestie. Nulla volutpat congue leo, at malesuada tortor ornare eget. Suspendisse porta ipsum vel enim lobortis, non aliquam tortor convallis. Aenean maximus, nibh ut sollicitudin porta, justo ipsum auctor mauris, vitae sagittis nisl lectus vel orci. In hac habitasse ictumst. Suspendisse ultricies lobortis accumsan. Nulla turpis justo, tristique sed magna et, pretium elementum ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque quis quam a nisl efficitur posuere.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi ex leo, lobortis eget libero in, venenatis tincidunt ipsum. Nulla ultrices purus in ornare ultricies. In et faucibus justo. Nunc in tempus diam, nec facilisis eros. Quisque non quam id mi rutrum volutpat vel ac purus. Suspendisse potenti. Etiam non orci porttitor, lacinia magna eget, imperdiet ex. Pellentesque bibendum ligula vel elit tincidunt, quis aliquam nisl consequat. Pellentesque facilisis lectus ac orci commodo, ac cursus nibh mollis. Nunc turpis ipsum, laoreet sit amet odio sit amet, aliquam dignissim nisi. Suspendisse potenti.</p>
<p>Nullam at sodales urna, quis pellentesque lectus. Aenean a augue consequat, viverra libero ut, varius ex. Duis id ipsum sed risus aliquet consectetur. Aliquam facilisis nunc quis purus rutrum lobortis. Praesent mollis tincidunt quam at molestie. Nulla volutpat congue leo, at malesuada tortor ornare eget. Suspendisse porta ipsum vel enim lobortis, non aliquam tortor convallis. Aenean maximus, nibh ut sollicitudin porta, justo ipsum auctor mauris, vitae sagittis nisl lectus vel orci. In hac habitasse ictumst. Suspendisse ultricies lobortis accumsan. Nulla turpis justo, tristique sed magna et, pretium elementum ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque quis quam a nisl efficitur posuere.</p>
</div>
I'm making portfolio website. After position fixed half transparent gradient animation and image the margin of images element don't work. When creating element #images i wanted to be under the text 10vh. I expected the image to be under text element. But the sample image is on the top and move the gradient down. Why and how to put the #images under the text?
https://codepen.io/abooo/pen/erQWBQ?editors=1100
*{margin:0;padding:0;}
html {
height:100%;
width:100%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
div#overlay{
position:fixed;
opacity:0.5;
background: linear-gradient(224deg, #a18cd1, #fbc2eb, #fbc2eb, #a6c1ee, #f6d365, #fda085, #84fab0, #8fd3f4, #a6c0fe, #f68084, #fccb90, #d57eeb, #e0c3fc, #8ec5fc, #f093fb, #f5576c, #4facfe, #00f2fe, #43e97b, #38f9d7, #30cfd0, #330867, #667eea, #764ba2, #fddb92, #d1fdff, #00c6fb, #005bea, #b721ff, #21d4fd, #d558c8, #24d292, #09203f, #537895);
background-size: 6800% 6800%;
height:100%;
width:100%;
-webkit-animation: GardientOverlay 200 ease infinite;
-moz-animation: GardientOverlay 200 ease infinite;
-o-animation: GardientOverlay 200s ease infinite;
animation: GardientOverlay 200s ease infinite;
}
#-webkit-keyframes GardientOverlay {
0%{background-position:99% 0%}
50%{background-position:2% 100%}
100%{background-position:99% 0%}
}
#-moz-keyframes GardientOverlay {
0%{background-position:99% 0%}
50%{background-position:2% 100%}
100%{background-position:99% 0%}
}
#-o-keyframes GardientOverlay {
0%{background-position:99% 0%}
50%{background-position:2% 100%}
100%{background-position:99% 0%}
}
#keyframes GardientOverlay {
0%{background-position:99% 0%}
50%{background-position:2% 100%}
100%{background-position:99% 0%}
}
div#text{
font-size:calc(6vh + 6vw);
}
div#containerText{
padding:1vw;
opacity:0.7;
position:absolute;
top:0;
height:100vh;
background-color:white;
z-index:10;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align:center;
display:flex;
align-items: center; /* Vertical center alignment */
justify-content: center;
}
.text{
left:0;
width:100vw;
top:100vh;
position:absolute;
background-color:white;
padding:calc(1vh + 1vw);
box-sizing: border-box;
font-size:2vmax;
}
div#images{
height:100vh;
width:100vw;
}
div#images img{
width:inherit;
height:inherit;
}
<html>
<head>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id='overlay'></div>
<div id='images'>
<img src='https://www.gstatic.com/webp/gallery/1.jpg' alt='gallery'/>
</div>
<div id='containerText'>
<div id='text'>Hi!</div>
</div>
<div class='text'>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas faucibus mattis quam sit amet sollicitudin. Vivamus quis ullamcorper velit. Phasellus vitae quam id libero tempus tempor in in velit. Maecenas at arcu nec felis feugiat mollis. Quisque et velit eu enim ullamcorper vestibulum eu convallis justo. Donec scelerisque purus ipsum, ut consequat enim scelerisque vitae. Aliquam dignissim massa non dolor sollicitudin, eleifend aliquam urna commodo. Pellentesque ut tristique erat. Sed non nisl ac odio consectetur tincidunt. Integer turpis sem, viverra et vulputate ut, dignissim id diam. Nullam venenatis, ante rhoncus tincidunt pulvinar, ex velit blandit nisi, ut laoreet ex odio vitae metus. Morbi arcu elit, congue a nisl vitae, euismod facilisis sapien. Donec gravida, lorem eu volutpat tristique, lectus erat pharetra justo, a aliquam massa quam tincidunt purus. Phasellus eu fringilla sapien. Quisque imperdiet magna sed sapien rutrum, quis mattis libero convallis. Vivamus non luctus leo.
</div>
</body>
</html>
Try html and css above.
I have a div with an image.
On hover, I want to make the image bigger and to display some text next to the div.
I want to show the text once the first transition (make the image bigger) has ended.
I've tried a lot of things but did not manage to find any solution, here is my last try :
.width-12 {
width: 100%;
height: 100%;
}
.change-hover {
width: 10%;
transition: all 1s;
float: left;
}
.show-hover {
display: none;
text-align: left;
opacity: 0;
transition: opacity 0s;
}
.discover-no-hover:hover .change-hover {
width: 24%;
float: left;
}
.discover-no-hover:hover .show-hover {
display: block;
opacity: 1;
transition-delay: 1s;
}
<div class="width-12 discover-no-hover">
<div class="box small bkg-white">
<div class="feature-column medium mb-50 center hover-align">
<div class="iconcool">
<img src="https://upload.wikimedia.org/wikipedia/commons/4/45/Carr%C3%A9_rouge.svg"
alt="" class="img-responsive change-hover">
</div>
<div class="show-hover">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus semper varius elit, at efficitur lorem bibendum ac. Nulla feugiat, orci et laoreet vehicula, turpis ligula venenatis diam, bibendum porttitor odio leo ut enim. Aenean pretium tristique mattis. Maecenas ullamcorper iaculis ornare. Ut vitae luctus purus. Suspendisse tincidunt, lorem quis ultrices varius, turpis turpis pellentesque ante.
</div>
</div>
</div>
</div>
JSfiddle for those who don't like the snippet
How can I make the text appear only after the image stopped growing ? (Or after 1s, wich is the duration of the image growing)?
Thank you !
You have
.show-hover {
display: none;
text-align: left;
opacity: 0;
transition: opacity 0s; /* this*/
}
Just amend this to
transition: 0s opacity 1s;
.width-12 {
width: 100%;
height: 100%;
}
.change-hover {
width: 10%;
transition: all 1s;
float: left;
}
.show-hover {
display: block;
text-align: left;
opacity: 0;
transition: 0s opacity 1s;
}
.discover-no-hover:hover .change-hover {
width: 24%;
float: left;
}
.discover-no-hover:hover .show-hover {
display: block;
opacity: 1;
transition-delay: 1s;
}
<div class="width-12 discover-no-hover">
<div class="box small bkg-white">
<div class="feature-column medium mb-50 center hover-align">
<div class="iconcool">
<img src="https://upload.wikimedia.org/wikipedia/commons/4/45/Carr%C3%A9_rouge.svg" alt="" class="img-responsive change-hover">
</div>
<div class="show-hover">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus semper varius elit, at efficitur lorem bibendum ac. Nulla feugiat, orci et laoreet vehicula, turpis ligula venenatis diam, bibendum porttitor odio leo ut enim. Aenean pretium tristique mattis.
Maecenas ullamcorper iaculis ornare. Ut vitae luctus purus. Suspendisse tincidunt, lorem quis ultrices varius, turpis turpis pellentesque ante.
</div>
</div>
</div>
</div>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
My codepen: http://codepen.io/anon/pen/dYOZYM
How can I edit the CSS so that it:
title and menu slide from top
article slide from left
image slide from right
#title a {
text-decoration: none;
font-size: 72px;
display: block;
color: black;
width: 100%;
animation-name: anim-title;
animation-duration: 5s
}
ol {
margin: 0px;
}
ol li {
list-style: none;
float: left;
width: 24%;
height: 4%;
transition-duration: 1s;
padding-top: 0.3%;
padding-bottom: 0.3%;
margin: 2px;
background-color: #BBBBBB;
border-radius: 5px;
}
#keyframes anim-article {
from {
margin-left: -60%;
}
to {
margin-left: 40px
}
}
#keyframes anim-title {
from {
margin-top: -100%;
}
to {
margin-top: 0px
}
}
ol li:hover {
background-color: #5D0102;
width: 26%;
}
li a {
text-decoration: none;
color: black;
display: block;
text-align: center;
padding: 1%;
font-size: 20px
}
#obraz>img {
height: 66%;
width: 40%;
margin-left: 40px;
float: left;
margin-top: 16px;
border: 2px solid #5D0102;
box-shadow: 0 0 10px black;
}
#article {
float: left;
width: 50%;
height: 67.5%;
margin-left: 40px;
background-color: white;
border: 2px solid #5D0102;
box-shadow: 0px 0px 10px black;
margin-top: 16px;
background-image: url();
animation-name: anim-article;
animation-duration: 5s
}
body {
background-size: 1366px 768px
}
hr {
background-color: #5D0102;
color: #5D0102;
height: 2px;
width: 94%;
}
<center>
<div id="title">Title
</div>
</center>
<hr>
<ol>
<li> Articled
</li>
<li> Tasks
</li>
<li> Galery
</li>
<li> Contact
</li>
</ol>
<br>
<br>
<hr>
<div id="article">
<article>
<h2><p>Title article</p></h2>
<p><font color="red">Curae, Donec est. Lorem ipsum primis in magna fringilla sem condimentum vitae, consequat lobortis diam. In gravida sit amet, consectetuer lobortis volutpat. Nam molestie. Phasellus a odio eget orci luctus ullamcorper risus. Nunc eleifend vel, nisl. Vestibulum ante ipsum ac imperdiet quis, lorem. Pellentesque suscipit dolor. Pellentesque felis. Mauris auctor varius. Cras non felis. Nam vestibulum. Aenean ut lacus diam id justo luctus et fringilla enim. Etiam tincidunt in, libero. Nulla augue id leo lacus, ullamcorper risus. Vivamus malesuada augue eget dolor ut tortor ante libero ante, luctus at, bibendum ac, eleifend mauris viverra nonummy, leo felis non sem. Suspendisse.</font>
</p>
<br>
<p><font color="blue">Curae, Donec est. Lorem ipsum primis in magna fringilla sem condimentum vitae, consequat lobortis diam. In gravida sit amet, consectetuer lobortis volutpat. Nam molestie. Phasellus a odio eget orci luctus ullamcorper risus. Nunc eleifend vel, nisl. Vestibulum ante ipsum ac imperdiet quis, lorem. Pellentesque suscipit dolor. Pellentesque felis. Mauris auctor varius. Cras non felis. Nam vestibulum. Aenean ut lacus diam id justo luctus et fringilla enim. Etiam tincidunt in, libero. Nulla augue id leo lacus, ullamcorper risus. Vivamus malesuada augue eget dolor ut tortor ante libero ante, luctus at, bibendum ac, eleifend mauris viverra nonummy, leo felis non sem. Suspendisse.</font>
</p>
<br>
<p><font color="green">Curae, Donec est. Lorem ipsum primis in magna fringilla sem condimentum vitae, consequat lobortis diam. In gravida sit amet, consectetuer lobortis volutpat. Nam molestie. Phasellus a odio eget orci luctus ullamcorper risus. Nunc eleifend vel, nisl. Vestibulum ante ipsum ac imperdiet quis, lorem. Pellentesque suscipit dolor. Pellentesque felis. Mauris auctor varius. Cras non felis. Nam vestibulum. Aenean ut lacus diam id justo luctus et fringilla enim. Etiam tincidunt in, libero. Nulla augue id leo lacus, ullamcorper risus. Vivamus malesuada augue eget dolor ut tortor ante libero ante, luctus at, bibendum ac, eleifend mauris viverra nonummy, leo felis non sem. Suspendisse.</font>
</p>
</article>
</div>
<div id="obraz">
<img src="obrazek.gif" alt="image .gif">
</div>
Try using the CSS animations this way using the delays.
* {font-family: 'Segoe UI'; box-sizing: border-box; margin: 0; padding: 0; list-style: none;}
body {text-align: center; overflow: hidden;}
header {margin: 0 0 15px; }
header nav ul {display: block; margin: 5px 0;}
header nav ul li {display: inline-block; margin: 5px;}
header nav ul li a {text-decoration: none; display: block; padding: 5px; border: 1px solid #999; border-radius: 5px; color: #000;}
header nav ul li a:hover {background-color: #ccf; border-color: #99f;}
article, aside {display: inline-block; width: 65%; vertical-align: top; text-align: justify; margin-right: 2%;}
aside {width: 25%;}
aside img {max-width: 100%; display: block;}
/* Transition */
header {animation-delay: 0;}
article {animation-delay: 0.5s;}
aside {animation-delay: 1s;}
.animated {
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
#-webkit-keyframes bounceInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateY(30px);
}
80% {
-webkit-transform: translateY(-10px);
}
100% {
-webkit-transform: translateY(0);
}
}
#keyframes bounceInDown {
0% {
opacity: 0;
transform: translateY(-2000px);
}
60% {
opacity: 1;
transform: translateY(30px);
}
80% {
transform: translateY(-10px);
}
100% {
transform: translateY(0);
}
}
.bounceInDown {
-webkit-animation-name: bounceInDown;
animation-name: bounceInDown;
}
#-webkit-keyframes bounceInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(-2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(30px);
}
80% {
-webkit-transform: translateX(-10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#keyframes bounceInLeft {
0% {
opacity: 0;
transform: translateX(-2000px);
}
60% {
opacity: 1;
transform: translateX(30px);
}
80% {
transform: translateX(-10px);
}
100% {
transform: translateX(0);
}
}
.bounceInLeft {
-webkit-animation-name: bounceInLeft;
animation-name: bounceInLeft;
}
#-webkit-keyframes bounceInRight {
0% {
opacity: 0;
-webkit-transform: translateX(2000px);
}
60% {
opacity: 1;
-webkit-transform: translateX(-30px);
}
80% {
-webkit-transform: translateX(10px);
}
100% {
-webkit-transform: translateX(0);
}
}
#keyframes bounceInRight {
0% {
opacity: 0;
transform: translateX(2000px);
}
60% {
opacity: 1;
transform: translateX(-30px);
}
80% {
transform: translateX(10px);
}
100% {
transform: translateX(0);
}
}
.bounceInRight {
-webkit-animation-name: bounceInRight;
animation-name: bounceInRight;
}
<header class="animated bounceInDown">
<h1>Title</h1>
<nav>
<ul>
<li>Articles</li>
<li>Tasks</li>
<li>Gallery</li>
<li>Contact</li>
</ul>
</nav>
</header>
<article class="animated bounceInLeft">
<p><b>Microsoft Corporation</b> <span class="nowrap"><span class="IPA nopopups">/<span style="border-bottom:1px dotted"><span title="/ˈ/ primary stress follows">ˈ</span><span title="'m' in 'my'">m</span><span title="/aɪ/ long 'i' in 'tide'">aɪ</span><span title="'k' in 'kind'">k</span><span title="'r' in 'rye'">r</span><span title="/ɵ/ variable 1st 'o' in 'omission'">ɵ</span><span title="'s' in 'sigh'">s</span><span title="/ɒː/ variable 'o' as in 'coffee'">ɒː</span><span title="'f' in 'find'">f</span><span title="'t' in 'tie'">t</span></span>/</span></span> (commonly referred to as <b>Microsoft</b>) is an American multinational technology company headquartered in Redmond, Washington, that develops, manufactures, licenses, supports and sells computer software, consumer electronics and personal computers and services. Its best known software products are the Microsoft Windows line of operating systems, Microsoft Office office suite, and Internet Explorer and Edge web browsers. Its flagship hardware products are the Xbox game consoles and the Microsoft Surface tablet lineup. It is the world's largest software maker measured by revenues. It is also one of the world's most valuable companies.</p>
<p>Microsoft was founded by Paul Allen and Bill Gates on April 4, 1975, to develop and sell BASIC interpreters for Altair 8800. It rose to dominate the personal computer operating system market with MS-DOS in the mid-1980s, followed by Microsoft Windows. The company's 1986 initial public offering, and subsequent rise in its share price, created three billionaires and an estimated 12,000 millionaires from Microsoft employees. Since the 1990s, it has increasingly diversified from the operating system market and has made a number of corporate acquisitions. In May 2011, Microsoft acquired Skype Technologies for $8.5 billion in its largest acquisition to date.</p>
<p>As of 2015, Microsoft is market dominant in both the IBM PC-compatible operating system (while it lost the majority of the overall operating system market to Android) and office software suite markets (the latter with Microsoft Office). The company also produces a wide range of other software for desktops and servers, and is active in areas including Internet search (with Bing), the video game industry (with the Xbox, Xbox 360 and Xbox One consoles), the digital services market (through MSN), and mobile phones (via the operating systems of Nokia's former phones and Windows Phone OS). In June 2012, Microsoft entered the personal computer production market for the first time, with the launch of the Microsoft Surface, a line of tablet computers.</p>
<p>With the acquisition of Nokia's devices and services division to form Microsoft Mobile Oy, the company re-entered the smartphone hardware market, after its previous attempt, Microsoft Kin, which resulted from their acquisition of Danger Inc.</p>
<p>Microsoft is a portmanteau of the words <b>micro</b>computer and <b>soft</b>ware.</p>
</article>
<aside class="animated bounceInRight">
<img src="https://upload.wikimedia.org/wikipedia/commons/1/1a/Microsoft_building_17_front_door.jpg" alt="Image" />
</aside>
For a small project, I need this little website that pulls data from a server via AJAX and outputs it like shown in this picture. However the problem isn't JavaScript, but pure HTML+CSS..
You can take a look at this page via jsfiddle by clicking this, or you can take a look at the quoted code that is quoted by the end of this post: http://jsfiddle.net/RdJUM/
The list is build with the following html snippet:
<div id="update">
<ul class="searchresults">
<li>
<h2>Caption</h2>
<div>
<img src="" alt="" />
<p>Text</p>
</div>
</li>
</ul>
</div>
It is formatted via CSS, but the important part is this:
#update ul li {
height: 110px;
overflow: hidden;
/* ... */
/*
-webkit-transition: height 0.3s ease-out;
-moz-transition: height 0.3s ease-out;
-o-transition: height 0.3s ease-out;
transition: height 0.3s ease-out;
*/
}
#update li:hover {
height: auto;
}
This works fine as long as you leave the transitions commented out. You hover on the article and it will scale the height to "auto" which gives exactly the height of your content and nothing more. However if you uncomment the transistions, WebKit (Chrome 30, Safari 6) do a really shaky effect that is completely unusable. For convenience this is the jsfiddle link to the uncommented version: http://jsfiddle.net/bQZ7F/
In Firefox 23 and Opera 12 this transition is deactivated, so it will behave as if the CSS part wasn't there.
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Live Search</title>
<link rel="stylesheet" href="mystyle.css" />
</head>
<body>
<div id="searcharea">
<label for="search">live search</label>
<p>Enter the name or info about a speaker</p>
<input type="search" name="search" id="search" placeholder="name or info" />
</div>
<div id="update">
<ul class="searchresults">
<li>
<h2>Lorem Ipsum</h2>
<div>
<img src="http://placehold.it/80x80" alt="" />
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer semper dui sit amet erat faucibus egestas. Vivamus eget commodo ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis ac magna metus. Donec eget auctor lorem. Cras vehicula nulla quis facilisis ultrices. Duis bibendum tellus ut porta suscipit. Pellentesque vitae orci a orci tincidunt posuere at et quam. Aliquam erat volutpat. Etiam dignissim egestas arcu non lacinia. Sed placerat sagittis enim eget bibendum. Suspendisse mollis consequat libero, ut porttitor eros consequat vitae. Mauris dolor nunc, ultrices eu leo sed, ornare lacinia quam. Pellentesque convallis massa at massa egestas, vestibulum vulputate dolor dignissim. Nullam sed metus a odio convallis molestie non a nisl. Donec eleifend lacus ut suscipit cursus. Cras viverra urna at arcu lacinia, in viverra neque pharetra. Suspendisse pellentesque tortor sit amet lacus elementum gravida et non risus. In cursus turpis vitae tortor molestie congue. Phasellus laoreet sit amet neque sit amet egestas. Aliquam sagittis ac massa vitae pulvinar. Vivamus bibendum odio sed enim porta pretium. Ut varius lacinia elit ut interdum. In in pretium metus.</p>
</div>
</li>
<li>
<h2>Lorem Ipsum</h2>
<div>
<img src="http://placehold.it/80x80" alt="" />
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer semper dui sit amet erat faucibus egestas. Vivamus eget commodo ante.</p>
</div>
</li>
<li>
<h2>Lorem Ipsum</h2>
<div>
<img src="http://placehold.it/80x80" alt="" />
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer semper dui sit amet erat faucibus egestas. Vivamus eget commodo ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Duis ac magna metus. Donec eget auctor lorem. Cras vehicula nulla quis facilisis ultrices. Duis bibendum tellus ut porta suscipit. Pellentesque vitae orci a orci tincidunt posuere at et quam. Aliquam erat volutpat. Etiam dignissim egestas arcu non lacinia. Sed placerat sagittis enim eget bibendum. Suspendisse mollis consequat libero, ut porttitor eros consequat vitae.</p>
</div>
</li>
<li>
<h2>Caption</h2>
<div>
<img src="" alt="" />
<p>Text</p>
</div>
</li>
</ul>
</div>
</body>
</html>
CSS:
/* #override
http://localhost/~simon/tests/ajax_search/mystyle.css */
body {
background: #DAD7C7;
}
#searcharea {
margin: 0 auto;
text-align: center;
background: #BF996B;
padding: 10px;
width: 30%;
-webkit-border-radius: 10px 10px 0 0;
-moz-border-radius: 10px 10px 0 0;
border-radius: 10px 10px 0 0;
}
#searcharea label {
font: bold 1.3em Arial;
text-transform: uppercase;
padding-bottom: 5px;
color: #A61C1C;
}
#searcharea p {
margin: 0;
line-height: 1em;
padding-bottom: 5px;
}
#searcharea input {
width: 80%;
text-align: center;
}
#update {
font-family: Georgia, "Times New Roman", Times, serif;
width: 70%;
margin: 0 auto;
border-top: 1px dotted #CCC;
}
#update ul {
list-style: none;
margin: 0;
padding: 0;
}
#update ul li {
width: 100%;
padding: 0 20px 20px;
background: #EEE;
height: 110px;
overflow: hidden;
border-bottom: 1px dotted #CCC;
-webkit-animation: myanim 1s;
-moz-animation: myanim 1s;
-o-animation: myanim 1s;
animation: myanim 1s;
-webkit-transition: height 0.3s ease-out;
-moz-transition: height 0.3s ease-out;
-o-transition: height 0.3s ease-out;
transition: height 0.3s ease-out;
}
#update li:hover {
background: #FFFCE5;
height: auto;
}
#update ul li div {
margin: 0;
padding: 0;
}
#update ul li div p {
margin: 0;
}
#update h2 {
margin: 0;
padding: 0;
font-size: 1.2em;
padding-bottom: 5px;
padding-top: 20px;
font-family: Arial, Helvetica, sans-serif;
color: #BF5841;
border-bottom: 1px dotted #CCC;
margin-bottom: 10px;
}
#update img {
float: left;
width: 80px;
margin-right: 10px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
#-webkit-keyframes myanim {
0% { opacity: 0.3; }
100% { opacity: 1.0; }
}
#-moz-keyframes myanim {
0% { opacity: 0.3; }
100% { opacity: 1.0; }
}
#-o-keyframes myanim {
0% { opacity: 0.3; }
100% { opacity: 1.0; }
}
#keyframes myanim {
0% { opacity: 0.3; }
100% { opacity: 1.0; }
}
Thanks for the hint, seems that it isn't possible without using JavaScript:
Set CSS to these values
#update ul li {
height: 110px;
/* ... */
}
#update li:hover {
background: #FFFCE5;
}
Principle of JavaScript code:
// Mouse-enter Event
curHeight = $(this).height();
autoHeight = $(this).css('height', 'auto').height();
$(this).height(curHeight).animate({height: autoHeight}, 1000);
// Mouse-leave Event
// same, but vice versa
You can grab the full code here: http://jsfiddle.net/9eaAq/