Paragraph is overlapping outside my div on hover - html

and I'm trying to add a black container below my video and add the title and description inside that black container on hover, but the description in overlapping the black container how to l keep it inside the black container.
.previewContainer.small {
position: relative;
width: 230px;
height: 129px;
margin-right: 4px;
display: inline-flex;
transition: 0.5s ease;
overflow: hidden;
white-space: nowrap;
flex: 1 1 0px;
transition: transform 500ms;
}
.title{
display: none;
}
.previewContainer.small:focus-within,
.previewContainer.small:hover{
margin-left: 65px;
transform: translateY(-50%) translateX(-50%);
z-index: 1;
width: 230px;
height: 250px;
background-color: #141414;
border-radius: 5px;
}
.small:focus ~ .small,
.small:hover ~ .small {
transform: translateX(25%);
}
.previewContainer.small:focus,
.previewContainer.small:hover {
transform: scale(1.6);
z-index: 1;
}
.Play{
position: absolute;
width: 100%;
display: flex;
margin-left: 10px;
background-color: transparent;
font-size: 10px;
padding: 0px;
transition-duration: 1s;
}
.title{
position: absolute;
text-transform: capitalize;
width: 100%;
display: flex;
margin-left: 10px;
background-color: transparent;
font-size: 5px;
transition-duration: 1s;
}
.description{
position: absolute;
display: flex;
padding-top: 30px;
margin-left: 10px;
background-color: transparent;
text-decoration:none;
overflow: hidden;
color: white;
}
.title h6{
color:#fff !important;
font-weight: 300;
font-size: 14px;
}
.video-item {
position: relative;
max-width: 100%;
transition: transform 0.2s;
z-index: 1;
cursor: pointer;
border-radius: 4px;
object-fit: cover;
}
<div class="previewContainer">
<div class="previewContainer small">
<a href"">
<video class="mylist-img video-item" onmouseover="this.play()" onmouseout="this.pause();">
<source src="https://sgcholdings.co.za/Backend/media/sample-30s.mp4">
Your browser does not support the video tag.
</video>
<div class="title">
<h6>Video One</h6>
</div>
<div class="description">
<p class="">Loren ipsum dolor sit amet because there are two,
there is web version which works on hover with a small pop up then </p>
</div>
</a>
</div>
</div>
so l want to contain the description to be inside that black background that comes when l hover. can someone assist how to contain the paragraph tag not to overlap

You can update your CSS with following code
.description {
white-space: normal;
}
white-space:normal Sequences of white space are collapsed. Newline characters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes.

In the CSS for div of class description add this rule
.description{
word-wrap: break-word;
}
CSS word-wrap property is used to break the long words and wrap them onto the next line. This property is used to prevent overflow when an unbreakable string is too long to fit in the containing box.
.previewContainer.small {
position: relative;
width: 230px;
height: 129px;
margin-right: 4px;
display: inline-flex;
transition: 0.5s ease;
flex: 1 1 0px;
transition: transform 500ms;
}
.title{
display: none;
}
.previewContainer.small:focus-within,
.previewContainer.small:hover{
margin-left: 65px;
transform: translateY(-50%) translateX(-50%);
z-index: 1;
width: 230px;
height: 300px;
background-color: #141414;
border-radius: 5px;
word-wrap: break-word;
}
.small:focus ~ .small,
.small:hover ~ .small {
transform: translateX(25%);
}
.previewContainer.small:focus,
.previewContainer.small:hover {
transform: scale(1.6);
z-index: 1;
}
.Play{
position: absolute;
width: 100%;
display: flex;
margin-left: 10px;
background-color: transparent;
font-size: 10px;
padding: 0px;
transition-duration: 1s;
}
.title{
position: absolute;
text-transform: capitalize;
width: 100%;
display: flex;
margin-left: 10px;
background-color: transparent;
font-size: 5px;
transition-duration: 1s;
}
.description{
position: absolute;
display: flex;
padding-top: 30px;
margin-left: 10px;
background-color: transparent;
text-decoration:none;
overflow: hidden;
color: white;
word-wrap: break-word;
}
.title h6{
color:#fff !important;
font-weight: 300;
font-size: 14px;
}
.video-item {
position: relative;
max-width: 100%;
transition: transform 0.2s;
z-index: 1;
cursor: pointer;
border-radius: 4px;
object-fit: cover;
}
<div class="previewContainer">
<div class="previewContainer small">
<a href"">
<video class="mylist-img video-item" onmouseover="this.play()" onmouseout="this.pause();">
<source src="https://sgcholdings.co.za/Backend/media/sample-30s.mp4">
Your browser does not support the video tag.
</video>
<div class="title">
<h6>Video One</h6>
</div>
<div class="description">
<p class="">Loren ipsum dolor sit amet because there are two,
there is web version which works on hover with a small pop up then </p>
</div>
</a>
</div>
</div>

Related

How to make ::after content have the same width an height as the previous?

I want to make a small button hover animation. the animation is like that:
a blue div which have the same width an height as the button comes from the bottom left of the button to cover it. The problem is that they have not the same height and width.
Here's the HTML and the css :
[![button{
box-sizing: border-box;
background-color: transparent;
border: none;
display: inline-block;
}
.button-wrapper {
position: relative;
overflow: hidden;
padding: 15px 30px;
font-family: 'Montserrat', sans-serif;
font-weight: bold;
font-size: 14px;
line-height: 20px;
border: solid 2px #2A5A8B;
border-radius: 6px;
text-decoration: none;
color: #2A5A8B;
cursor : pointer;
transition: all .5s;
z-index: 1;
}
.button-wrapper::after{
width: 100%;
height: 100%;
margin: auto;
position: absolute;
bottom: -100%;
right: -100%;
background-color: #2A5A8B;
transition: all .25s;
z-index: -1;
content: '';
}
.button-wrapper:hover{
color: white;
}
.button-wrapper:hover::after{
transform: translateX(-100%) translateY(-100%);
}
<button>
<div className='button-wrapper'>
{Login}
</div>
</button>
PS: it's working properly on firefox.

How to make pull up effect during hovering element? Just see this code once

I am trying to create an effect when div class="container" is being hovered, a smooth upper transition occurs of another div from bottom. Only during hover, this should happen cause I want that .bottom div to be hidden. When that div is not hidden, I can see the effect as I want. But as I hide the bottom div, that hovering effect smooth transition effect cannot be seen. Check this code once.
HTML CODE
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
CSS code
.box{
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top:80px;
left:0;
/* display: none; */
}
.box:hover .bottom {
display: block;
transition: linear 0.2s;
top:55px;
}
Here is the codepen link
https://codepen.io/Biebk/pen/MWpREqb
First off, rather than display: none to hide the incoming element altogether, you can set its opacity to 0, and then when the parent is hovered, set it to 1, like so:
.bottom {
opacity: 0;
}
.box:hover .bottom {
opacity: 1;
}
I suppose that given you want an incoming "pull-up" effect on hover, you want to that element to also "pull-down" when the hover ends. You can reverse the same effect by using a :not(:hover) on the parent element:
.box:not(:hover) .bottom {
opacity: 0;
}
Also, be sure to set the transition on the non-hovered state. The following example provides the smooth transition you're looking for:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
transition: all .25s ease;
}
.box:not(:hover) .bottom {
top: 80px;
opacity: 0;
}
.box:hover .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
<div class="bottom">
Everyone
</div>
</div>
A secondary approach would be to place the bottom div as a sibling to the box, and use the adjacent sibling combinator to apply the hover effects:
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
font-size: 20px;
background: pink;
width: 80px;
text-align: center;
position: absolute;
left: 0;
top: 80px;
opacity: 0;
cursor: default;
transition: all .25s ease;
}
.box:hover + .bottom {
top: 55px;
opacity: 1;
}
<div class="box">
Hello
</div>
<div class="bottom">
Everyone
</div>
Use opacity property rather than display to achieve the desired effect, then
use the following code
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
opacity: 0;
}
.box:hover .bottom{
opacity: 1;
transition: opacity 0.2s , top 1s;
top: 55px;
}
Use the following code.
.box {
border: 1px solid black;
display: inline-block;
border-radius: 3px;
padding: 8px;
font-size: 20px;
}
.hovered{
transition: all .2s;
}
.bottom {
background: pink;
width: 80px;
text-align: center;
position: absolute;
top: 80px;
left: 0;
visibility: hidden;
}
.hovered:hover+.bottom {
transition: all .2s;
top: 55px;
visibility: visible;
}
<div class="box">
<div class="hovered">Hello</div>
<div class="bottom">
Everyone
</div>
</div>

how can i make text visible when hover on image

why when the mouse hover over the image the text do not show ?
how to get the visibility of the text using visibility property in css
img{
margin-top: 110px;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
margin-top: 50px;
position: relative;
}
.txt{
font-size: 16px;
line-height: 20px;
margin-top: 10px;
text-align: center;
margin-left: 440px;
margin-right: 440px;
visibility: hidden;
}
img:hover .txt{
cursor: pointer;
visibility: visible;
}
<div class="container">
<img src="empty-boxes.svg" style="width:520px;height:190px;">
<p class="number">404</p>
<p class="txt">When communicating via HTTP, the server is required
.</p>
</div>
Add the CSS "~" selector.
img {
margin-top: 110px;
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
margin-top: 50px;
position: relative;
}
.txt {
font-size: 16px;
line-height: 20px;
margin-top: 10px;
text-align: center;
margin-left: 440px;
margin-right: 440px;
visibility: hidden;
}
img:hover ~ .txt {
cursor: pointer;
visibility: visible;
}
<div class="container">
<img src="empty-boxes.svg" style="width:520px;height:190px;">
<p class="number">404</p>
<p class="txt">When communicating via HTTP, the server is required .
</p>
</div>
You can also change the opacity of the text when hover on image
.txt {
opacity: 0;
}
img:hover~ .txt{
opacity: 1;
}
I recommend you to hover on the image container instead of the image itself. You can add transition on .txt to make it good looking.

CSS button transition stops playing

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

Fade back DIV on hover- even when hovering over front DIV

I'm looking for a CSS only solution to fade an image in a back DIV when hovering over any section of the DIV, including DIVs that are in front of it.
Here is what I've been able to build so far: http://jsfiddle.net/kqo10jLb/
The CSS:
#caseouter {
position: relative;
top: 0px;
}
#casewrap2 {
background-color: #000;
}
#casetitle {
font-size: 30px;
width: 100%;
display: block;
text-transform: uppercase;
text-align: center;
padding: 10px 0px 0px 0px;
color: #fff;
margin-bottom: 0px;
}
#casethumb {
width: 100%;
display: block;
margin-bottom: -100px;
opacity: 1;
transition: .2s opacity ease .2s;
height: 100px;
}
#casesecondline {
font-size: 30px;
color: #666;
text-transform: uppercase;
margin: 0 auto;
display: block;
width: 100%;
text-align: center;
color: #fff;
margin-top: -10px;
padding: 0px;
}
#casethumb img {
width: 100%;
}
#casethumb:hover {
opacity: .75;
}
#casetitle:hover ~ #casethumb a {
opacity: .75;
}
#casesecond:hover ~ #casethumb a {
opacity: .75;
}
And the HTML:
<div id="casewrap2">
<div id="casethumb">
<a href="www.google.com">
<img src="http://ringer.tv/wp-content/uploads/2014/08/case_bravo.jpg">
</a>
</div>
</div>
<div id="caseouter">
<a href="www.google.com">
<div id="casetitle">Headline</div>
<div id="casesecondline">Subheadline</div>
</a>
</div>
As you'll see, the back image fades on hover, however, it will not fade when I hover over the headline and subheadline text. I've tried using #casetitle:hover ~ #casethumb a but I'm obviously doing something wrong. Thanks!
Is this what you're after? http://jsfiddle.net/kqo10jLb/1/
I moved the caseouter into the casewrap2 object and changed the hover to this:
#casewrap2:hover #casethumb {
opacity: .75;
}