I have added transition effects to a container div that contains videos. I getting a black screen where the video embed is supposed to be. I tried both youtube and vimeo and they're both not working, so I think it has something to do with flash. When I comment the transition settings out, the video works again. Any ideas what could be going on and how to fix it?
Edit:
http://jsfiddle.net/bUFXA
Here's the code:
<div class="super-container">
<section class="main-content">
<div class="container">
<div class="inner">
<div class="row">
<div class="span8">
<div class="entries">
<article id="post-168" class="post-168 post type-post status-publish format-video hentry category-uncategorized category-videos tag-bring-the-noize tag-m-i-a tag-video instock">
<div class="entry-header">
<div class="video_player">
<iframe width="850" height="478" src="http://www.youtube.com/embed/cCkIYkaLBGs?feature=oembed" frameborder="0" allowfullscreen></iframe>
</div><!--video_player-->
<div class="video-caption">M.I.A. - Bring The Noize</div>
</div><!-- .entry-header -->
<div class="entry-content">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu feugiat purus. Quisque urna diam, consectetur sit amet est id, rhoncus sollicitudin odio. Phasellus rutrum tellus vitae tincidunt mattis. Proin lobortis pharetra hendrerit. Vivamus id urna arcu. Pellentesque luctus nulla sapien, vel interdum mi luctus a. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu feugiat purus. Quisque urna diam, consectetur sit amet est id, rhoncus sollicitudin odio. Phasellus rutrum tellus vitae tincidunt mattis. Proin lobortis pharetra hendrerit. Vivamus id urna arcu.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu feugiat purus. Quisque urna diam, consectetur sit amet est id, rhoncus sollicitudin odio. Phasellus rutrum tellus vitae tincidunt mattis. Proin lobortis pharetra hendrerit. Vivamus id urna arcu. Pellentesque luctus nulla sapien, vel interdum mi luctus a. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras eu feugiat purus. Quisque urna diam, consectetur sit amet est id, rhoncus sollicitudin odio. Phasellus rutrum tellus vitae tincidunt mattis. Proin lobortis pharetra hendrerit. Vivamus id urna arcu.</p>
</div><!-- .entry-content -->
</article><!-- #post -->
<article> (...) </article>
<article> (...) </article>
<article> (...) </article>
</div>
</div>
</div>
</div>
</div>
</section>
The CSS:
.super-container {
position: relative;
width: 100%;
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: -webkit-transform 500ms ease;
-moz-transition: -moz-transform 500ms ease;
-o-transition: -o-transform 500ms ease;
transition: transform 500ms ease;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
}
Ok, I managed to get it to work. I simply had to set the values of the translate3d to 1 like so:
-webkit-transform: translate3d(1, 0, 0);
-moz-transform: translate3d(1, 0, 0);
-ms-transform: translate3d(1, 0, 0);
-o-transform: translate3d(1, 0, 0);
transform: translate3d(1, 0, 0);
I also used translateX instead of translate3d, because I need it for a hidden menu where the entire content is moved to the left. So I only needed the X-coordinate after all. Anyway, the default value needed to be 1 instead of 0. That solved the problem with the video. The JSFiddle is here: http://jsfiddle.net/UrPMj/13/
In the jsFiddle I constructed with your code, nothing seems to be wrong. But I also don't see any animation. Do you first see the animation and then the player?
Here you can see how the jsFiddle displays on my computer:
I think your problem is in the code:
-webkit-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
-webkit-transition: -webkit-transform 500ms ease;
-moz-transition: -moz-transform 500ms ease;
-o-transition: -o-transform 500ms ease;
transition: transform 500ms ease;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
backface-visibility: hidden;
Because if I do a simple animation (one line) it works fine.
For example:
.super-container {
position: relative;
width: 100%;
transform:rotate(7deg);
-ms-transform:rotate(7deg); /* IE 9 */
-webkit-transform:rotate(7deg); /* Safari and Chrome */
}
Yields:
Which displays perfectly fine. You can check it out HERE.
So what I suggest is that you rewrite the CSS3 animations line by line and see where it stops working (right now you have too much redundant code which can collide with the other code; hence preventing display of the iFrame)
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 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>
I was experience a problem with the following code. I have a spoiler button who show a spoiler text that initially is showed with text-shadow to hide the content.
In Chrome, when I put the cursor over the spoiler button, it doesn't work well as you can see, it's difficult to click to show the spoiler.
If I remove the text-shadow property from span.show-spoiler-text it works ok.
I think this only happen in Webkit navigators, because I tried in Firefox and works perfectly.
How could I fix it?
Thank you in advance.
$(function()
{
$("span.spoiler-text .show-spoiler-text").click(function() {
var show_spoiler = $(this);
var spoiler = show_spoiler.closest('span.spoiler-text');
if (spoiler.hasClass('showing')) {
spoiler.removeClass("showing");
} else {
spoiler.addClass("showing");
}
});
});
span.show-spoiler-text {
background: #610B0B;
color: white;
text-transform: uppercase;
font-size: 10px;
padding: 5px;
border-radius: 5px;
margin-right: 5px;
cursor: pointer;
text-shadow: 0 0 0px #610B0B;
}
span.show-spoiler-text:hover, .spoiler-text.showing span.show-spoiler-text {
font-weight: bold;
}
.spoiler-text .spoiler-text-content {
text-shadow: 0 0 15px #610B0B;
color: transparent;
-webkit-transition: text-shadow 0.2s linear;
-moz-transition: text-shadow 0.2s linear;
-ms-transition: text-shadow 0.2s linear;
-o-transition: text-shadow 0.2s linear;
transition: text-shadow 0.2s linear;
}
.spoiler-text.showing .spoiler-text-content
{
text-shadow: 0 0 0px #610B0B;
color: #610B0B;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p class="entry-text">Lorem ipsum dolor <span class="spoiler-text"><span class="show-spoiler-text">Spoiler</span><span class="spoiler-text-content"> sit amet, consectetur adipiscing elit. Nullam luctus eu felis tristique facilisis. Nullam ut tristique tortor, vel varius tortor.</span></span>Nullam nibh nunc, ultricies at luctus quis, sodales posuere risus. Proin sagittis consectetur neque, ut laoreet nibh fringilla sit amet. Quisque tempor metus erat, at blandit mi rhoncus a. Mauris elementum mollis mollis. Quisque sit amet sollicitudin tortor, id aliquet mi. Donec convallis elit nec turpis volutpat, quis ornare leo lacinia. Proin dictum at mauris et tincidunt. Integer semper sed massa non tincidunt. Fusce facilisis, tellus vitae rhoncus aliquam, mi felis cursus tortor, non finibus augue ligula id enim. Sed ullamcorper enim quis pharetra sagittis.</p>
For the span to display the way you want, you have to set it to display: block;, set it's width and use float: left on the spoiler and on the span before. Also, you should always use span to place text, it's easier to manipulate with javascript.
$(function()
{
$("span.spoiler-text .show-spoiler-text").click(function() {
var show_spoiler = $(this);
var spoiler = show_spoiler.closest('span.spoiler-text');
if (spoiler.hasClass('showing')) {
spoiler.removeClass("showing");
} else {
spoiler.addClass("showing");
}
});
$(".spoiler-text").prev().css("float", "left");
});
span.show-spoiler-text {
background: #610B0B;
color: white;
text-transform: uppercase;
font-size: 10px;
padding: 3px;
border-radius: 5px;
margin: 0 5px;
cursor: pointer;
text-shadow: 0 0 0px #610B0B;
display: block;
width: 44px;
float: left;
}
span.show-spoiler-text:hover, .spoiler-text.showing span.show-spoiler-text {
font-weight: bold;
}
.spoiler-text .spoiler-text-content {
text-shadow: 0 0 15px #610B0B;
color: transparent;
-webkit-transition: text-shadow 0.2s linear;
-moz-transition: text-shadow 0.2s linear;
-ms-transition: text-shadow 0.2s linear;
-o-transition: text-shadow 0.2s linear;
transition: text-shadow 0.2s linear;
}
.spoiler-text.showing .spoiler-text-content
{
text-shadow: 0 0 0px #610B0B;
color: #610B0B;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<p class="entry-text">
<span>Lorem ipsum dolor</span>
<span class="spoiler-text">
<span class="show-spoiler-text">Spoiler</span>
<span class="spoiler-text-content"> sit amet, consectetur adipiscing elit. Nullam luctus eu felis tristique facilisis. Nullam ut tristique tortor, vel varius tortor.
</span>
</span>
Nullam nibh nunc, ultricies at luctus quis, sodales posuere risus. Proin sagittis consectetur neque, ut laoreet nibh fringilla sit amet. Quisque tempor metus erat, at blandit mi rhoncus a. Mauris elementum mollis mollis. Quisque sit amet sollicitudin tortor, id aliquet mi. Donec convallis elit nec turpis volutpat, quis ornare leo lacinia. Proin dictum at mauris et tincidunt. Integer semper sed massa non tincidunt. Fusce facilisis, tellus vitae rhoncus aliquam, mi felis cursus tortor, non finibus augue ligula id enim. Sed ullamcorper enim quis pharetra sagittis.</p>
Finally, I can solve putting position:relative in the .spoiler-text .spoiler-text-content element.
$(function()
{
$("span.spoiler-text .show-spoiler-text").click(function() {
var show_spoiler = $(this);
var spoiler = show_spoiler.closest('span.spoiler-text');
if (spoiler.hasClass('showing')) {
spoiler.removeClass("showing");
} else {
spoiler.addClass("showing");
}
});
});
span.show-spoiler-text {
background: #610B0B;
color: white;
text-transform: uppercase;
font-size: 10px;
padding: 5px;
border-radius: 5px;
margin-right: 5px;
cursor: pointer;
text-shadow: 0 0 0px #610B0B;
}
span.show-spoiler-text:hover, .spoiler-text.showing span.show-spoiler-text {
font-weight: bold;
}
.spoiler-text .spoiler-text-content {
text-shadow: 0px 0 15px #610B0B;
color: transparent;
-webkit-transition: text-shadow 0.2s linear;
-moz-transition: text-shadow 0.2s linear;
-ms-transition: text-shadow 0.2s linear;
-o-transition: text-shadow 0.2s linear;
transition: text-shadow 0.2s linear;
position:relative;
}
.spoiler-text.showing .spoiler-text-content
{
text-shadow: 0 0 0px #610B0B;
color: #610B0B;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p class="entry-text">
<span>Lorem ipsum dolor
Nullam nibh nunc, ultricies at luctus quis, sodales posuere risus. Proin sagittis consectetur neque, ut laoreet nibh fringilla sit amet. Quisque tempor metus erat, at blandit mi rhoncus a. Mauris elementum mollis mollis. Quisque sit amet sollicitudin tortor, id aliquet mi.</span><span class="spoiler-text">
<span class="show-spoiler-text">Spoiler</span>
<span class="spoiler-text-content"> sit amet, consectetur adipiscing elit. Nullam luctus eu felis tristique facilisis. Nullam ut tristique tortor, vel varius tortor. aaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</span>
</span> Donec convallis elit nec turpis volutpat, quis ornare leo lacinia. Proin dictum at mauris et tincidunt. Integer semper sed massa non tincidunt. Fusce facilisis, tellus vitae rhoncus aliquam, mi felis cursus tortor, non finibus augue ligula id enim. Sed ullamcorper enim quis pharetra sagittis.</p>
I have a content box, which contains a standard lorem ipsum text.
Like this the page looks just like it should:
But when I add more content into the content box so that it becomes too wide vertically, for some reason the page also becomes too wide horizontally:
Code(HTML):
<!-- Copyright © 2015 Enter|Elysium -->
<!-- Template made by Joonas Coatanéa -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="This is the Enter|Elysium theme.">
<meta name="keywords" content="Enter|Elysium,theme">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link type="text/css" rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="jQuery/jQuery.js"></script>
<script type="text/javascript" src="js/navbarController.js"></script>
<title>Enter|Elysium - Welcome!</title>
</head>
<body>
<div id="responsiveContainer">
<a class="nFx" href="#" alt="EnterElysium">
<p class="logoText">E<span class="sFSize">NTER</span>E<span class="sFSize">LYSIUM</span></p>
<img id="EnterElysiumLogo" src="images/EnterElysiumLogo.png" width="149" height="111" alt="EnterElysium"/>
</a>
<a class="nFx" href="https://www.youtube.com/user/EnterElysium" alt="Watch my videos" target="new">
<img id="youtube" align="right" src="images/YouTube-Icon.png" width="50" height="36" alt="Watch my videos"/>
</a>
<a class="nFx" href="http://www.twitch.tv/enterelysium" alt="Watch my streams" target="new">
<img id="twitch" align="right" src="images/Twitch-Icon.png" width="50" height="51" alt="Watch my streams"/>
</a>
<a class="nFx" href="https://www.facebook.com/EnterElysiumYT" alt="Follow me on Facebook" target="new">
<img id="facebook" align="right" src="images/Facebook-Icon.png" width="40" height="40" alt="Follow me on Facebook"/>
</a>
<a class="nFx" href="https://twitter.com/EnterElysium" alt="Follow me on Twitter" target="new">
<img id="twitter" align="right" src="images/Twitter-Icon.png" width="50" height="50" alt="Follow me on Twitter"/>
</a>
<a class="nFx" href="https://plus.google.com/+EnterElysium/posts" alt="Follow me on Google+" target="new">
<img id="googlePlus" align="right" src="images/GooglePlus-Icon.png" width="40" height="40" alt="Follow me on Google+"/>
</a>
<a class="nFx" href="https://www.patreon.com/EnterElysium" alt="Support me on Patreon" target="new">
<img id="patreon" align="right" src="images/Patreon-Icon.png" width="40" height="40" alt="Support me on Patreon"/>
</a>
<div id="navbar">
<ul>
<li><a class="activeNavA" href="#">Active Navbar Element</a></li>
<li><a class="navA" href="#">Navbar Element</a></li>
<li><a class="navA" href="#">Navbar Element</a></li>
<li><a class="navA" href="#">Navbar Element</a></li>
</ul>
</div>
<div id="siteContent">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus maximus turpis id justo viverra accumsan. Suspendisse non porta turpis. Etiam auctor iaculis nunc, a dignissim leo porta eu. Maecenas sit amet sem ac odio mollis blandit condimentum et lacus. In bibendum felis non enim tempor, id lobortis nisl convallis. Donec consequat interdum mauris, sit amet mollis libero placerat pulvinar.</p>
</div>
</div>
</body>
</html>
Code(CSS):
/* Copyright © 2015 Enter|Elysium */
/* Template made by Joonas Coatanéa */
/* Fonts Section */
#font-face {
font-family: SourceSansProBold;
src: url(../fonts/SourceSansPro-Bold.otf);
}
#font-face {
font-family: SourceSansProRegular;
src: url(../fonts/SourceSansPro-Regular.otf);
}
/* End Of Fonts Section */
/* Do not change the code below, if you are not sure of what you are doing! */
*, body {
margin: 0;
padding: 0;
}
/* Do not change the code above, if you are not sure of what you are doing! */
/* Website Background Color Section */
body {
background-color: #005399;
}
/* End Of Website Background Color Section */
/* Do not change the code below, if you are not sure of what you are doing! */
#responsiveContainer {
width: 100vw;
}
/* Do not change the code above, if you are not sure of what you are doing! */
/* Logo Section */
.logoText {
color: #FFFFFF;
font-family: SourceSansProBold;
font-size: 70px;
text-shadow: 0px 4px 0px #000000;
display: inline;
}
.sFSize {
font-size: 50px;
}
#EnterElysiumLogo {
margin-top: 50px;
margin-bottom: -15px;
}
/* End Of Logo Section */
/* Navbar Section */
#navbar {
height: 40px;
background-color: #FFFFFF;
box-shadow: 0px 2px 0px #000000;
width: 100vw;
}
#navbar ul {
list-style-type: none;
text-align: center;
}
#navbar ul li {
display: inline;
vertical-align: middle;
line-height: 40px;
margin-left: 5px;
margin-right: 5px;
}
/* End Of Navbar Section */
/* Website Icons Section */
#youtube {
margin-top: 120px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#youtube:hover {
width: 40px;
height: 29px;
}
#twitch {
margin-top: 113px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#twitch:hover {
width: 40px;
height: 41px;
}
#facebook {
margin-top: 116px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#facebook:hover {
width: 30px;
height: 30px;
}
#twitter {
margin-top: 116px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#twitter:hover {
width: 40px;
height: 40px;
}
#googlePlus {
margin-top: 117px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#googlePlus:hover {
width: 30px;
height: 30px;
}
#patreon {
margin-top: 118px;
margin-right: 8px;
transition: height 0.5s, width 0.5s;
-moz-transition: height 0.5s, width 0.5s;
-webkit-transition: height 0.5s, width 0.5s;
-o-transition: height 0.5s, width 0.5s;
}
#patreon:hover {
width: 30px;
height: 30px;
}
/* End Of Website Icons Section */
/* Link Section */
.nFx {
text-decoration: none;
}
.activeNavA {
background-color: #01345E;
padding-top: 11px;
padding-bottom: 10px;
padding-left: 5px;
padding-right: 5px;
text-decoration: none;
color: #005399;
font-family: SourceSansProRegular;
transition: background-color 0.5s;
-moz-transition: background-color 0.5s;
-webkit-transition: background-color 0.5s;
-o-transition: background-color 0.5s;
}
.activeNavA:hover {
background-color: #004680;
}
.activeNavA:visited {
color: #005399;
}
.navA {
background-color: #E0E0E0;
padding-top: 10px;
padding-bottom: 9px;
padding-left: 5px;
padding-right: 5px;
text-decoration: none;
color: #005399;
font-family: SourceSansProRegular;
transition: background-color 0.5s;
-moz-transition: background-color 0.5s;
-webkit-transition: background-color 0.5s;
-o-transition: background-color 0.5s;
}
.navA:hover {
background-color: #01345E;
}
.navA:visited {
color: #005399;
}
/* End Of Link Section */
/* Site Content Section */
#siteContent {
background-color: #FFF;
width: 50%;
margin: 0 auto;
margin-top: 80px;
text-align: center;
font-family: SourceSansProRegular;
box-shadow: 0px 1px 10px #000000;
margin-bottom: 50px;
}
/* End Of Site Content Section */
Do not use 100vw units for container width, as vw uses the size of viewport, without including the scrollbar. I changed the width of #responsiveContainer and #navbar to 100% instead and it now works properly.
JSFiddle for you
Some more info on vw units: https://css-tricks.com/viewport-sized-typography/
try this:
body{
overflow-x: hidden;
overflow-y: scroll;
}
It allows to scroll vertically but not horizontally !
Hello
I'm making a mailbox for my website and I want it to show/hide with CSS3 I know there are few tutorial etc on how to do it, but I tried to do it a bit differently. I'm getting a good result, however there is one issue. When I hover on an item the item:hover height are not changing together with the text:
styles.css:
.mailbox_item {
width: 440px;
height: 20px;
margin: 0 auto;
border-bottom: 1px solid #ccc;
overflow: hidden;
}
.mailbox_item:hover {
min-height: 100px;
overflow: visible;
display: block;
-webkit-transition: all 0s ease-in-out;
-moz-transition: all 0s ease-in-out;
-o-transition: all 0s ease-in-out;
-ms-transition: all 0s ease-in-out;
transition: all 0s ease-in-out;
}
.mailbox_item_top {
min-height: 20px;
line-height: 13px;
}
.mailbox_item_body {
min-height: 20px;
}
item.php
<div class="mailbox_item">
<div class="mailbox_item_top">
<h2 class="titleannouncement">Test Announcement</h2>
<span class="mail_author">0</span>
</div>
<div class="mailbox_item_body">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus lacinia dui at mattis. Donec vitae tellus congue leo egestas tincidunt a eget lorem. Fusce et varius velit. In sollicitudin porta arcu, vel convallis mauris varius ut. Aenean id risus a ante mattis bibendum. Sed mollis ipsum ac metus fringilla eget imperdiet urna laoreet. Quisque tincidunt, purus eu vulputate pulvinar, metus arcu malesuada ante, vitae vehicula ipsum lectus ac libero. Cras in ligula at urna tincidunt tempor. Nam sodales lectus a sem sodales congue. Suspendisse ut ultricies nunc. Aenean blandit tempor ipsum lacinia tincidunt. Mauris ut ipsum non dolor luctus volutpat. Cras quis enim at lacus placerat dictum ut et elit. Vestibulum porta varius dui, rutrum gravida orci semper sit amet. Nam ornare iaculis velit, sit amet euismod felis pulvinar et. Nam sed ipsum eget elit adipiscing tristique.</p>
</div>
<div class="newsdate">
<span class="newsdatetext">2011-04-30 06:54:05</span>
</div>
</div>
and here is what I'm getting:
Normal state - this is as intended
on :hover - the min-height value in mailbox_item:hover stays the same and doesn't get higher when the text gets bigger
on Hover
I know that I can use overflow:hidden; so the text wont overlap the other window but I wanted to show that there is more text. How can I force the min-height value to change if there is more text?
thanks in advance
You could set height:auto property on the :hover rule so that the browser correctly calculates the height when the menu item is hovered, overriding the fixed height:20px in the .mailbox_item rule. See this demo.
Or if you want to use CSS text-overflow you could have a double hover whereby you show some of the message when hovering on the menu item and then the full message when you hover over the message - see this demo.
You should consider the user experience of having lots of hover events. It is probably distracting to have an inbox like list of messages in which the message body shown and hidden when hovering over the message item.
I hope this helps.
The only way to do that will be with javascript (jquery will make it easier).
You can also try
overflow: auto;
If you want a pure css solution that will add a scrollbar when it overflows.