Dropdown menu fades in, but doesn't fade out - html

I've coded a dropdown menu with HTML and CSS, and I can sucessfully have it fade in when the user's mouse hovers over the button in the menu. However, when the mouse leaves the dropdown, the dropdown doesn't fade out, it just disappears? I believe this is a syntax error but I'm not sure where. How can I make the dropdown fade out just like I made it fade in?
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
visibility: visible;
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
float: left;
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
visibility: hidden;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: visibility 0s, transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>

Your CSS transition says for the div's visibility to change in zero seconds:
.top-block-dropdown { transition: visibility 0s ... }
So the div disappears instantly. You just need a longer transition time.

Because your transition has visibility 0s. Give that a non-zero value and the visibility transitions. Or just remove visibility from all of those definitions. opacity will suffice.
.top-block-container {
float: left;
width: 50%;
margin: 0.5% 0.25%;
}
.top-block-container:hover .top-block-dropdown {
opacity: 1;
transform: translateY(0);
height: auto;
}
.top-block {
width: 100%;
font-family: Lato;
font-weight: 900;
text-align: center;
padding: 10px 0;
border-radius: 50px;
font-size: 25px;
transition: background-color 0.25s linear, box-shadow 0.25s linear;
float: left;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
box-shadow: 0 0 5px black;
margin: 0;
}
.top-block:hover {
cursor: pointer;
box-shadow: 0 0 15px black;
}
.top-block-dropdown {
width: 100%;
background: linear-gradient(to bottom, #CCCCCC, #AAAAAA);
margin-top: 7.5px;
border-radius: 25px;
box-shadow: 0 0 15px black;
opacity: 0;
height: 0;
transform: translateY(-2em);
transition: transform 0.25s, opacity 0.25s linear;
}
.dropdown-option-heading {
font-family: Lato;
font-weight: 700;
margin: 5px 0 0 0;
padding: 5px 10px;
border-bottom: 2px solid white;
}
.dropdown-option {
font-family: Lato;
font-weight: 400;
text-align: center;
border-bottom: 1px solid white;
margin: 0;
padding: 5px 10px;
transition: box-shadow 0.25s linear;
}
.dropdown-option:hover {
background: linear-gradient(to top, dodgerblue, #00B0FF);
cursor: pointer;
}
.last-option {
border: 0;
border-bottom-left-radius: 25px;
border-bottom-right-radius: 25px;
}
<div class="top-block-container">
<h1 class="top-block">ECWMF</h1>
<div class="top-block-dropdown">
<p class="dropdown-option-heading">Global Models</p>
<p class="dropdown-option">GFS</p>
<p class="dropdown-option">ECMWF</p>
<p class="dropdown-option">CMC</p>
<p class="dropdown-option">NAVGEM</p>
<p class="dropdown-option">UKMET</p>
<p class="dropdown-option-heading">Mesoscale Models</p>
<p class="dropdown-option">HRRR</p>
<p class="dropdown-option">HWRF</p>
<p class="dropdown-option">NAM 32km</p>
<p class="dropdown-option">NAM 12km</p>
<p class="dropdown-option">RAP</p>
<p class="dropdown-option">SREF</p>
<p class="dropdown-option last-option">HIRESW</p>
</div>
</div>

Related

CSS Transition: ease-out hiccups on chrome

I'm working on some buttons that fill with a color when you hover over the button. The transition works perfectly on safari that runs on a MacBook. But when I do the animation on my windows device with Chrome, it has a hiccup on the end with multiple flashes. I have searched around for a solution but I couldn't find any.
.button_slide {
color: black;
border: 2px solid #ffffff;
border-radius: 0px;
padding: 18px 45px;
display: inline-block;
font-family: "Lucida Console", Monaco, monospace;
font-size: 14px;
letter-spacing: 5px;
cursor: pointer;
box-shadow: inset 0 0 0 0 #ffffff;
/* -webkit-transition: ease-out 0.4s !important;
-moz-transition: ease-out 0.4s !important; */
transition: ease-out 0.4s;
}
.slide_diagonal:hover {
box-shadow: inset 400px 50px 0 0 #007ACC;
border: 2px solid #007ACC;
}
#outer {
position: relative;
top: 60%;
left: 50%;
transform: translate(-50%,-50%);
width: 364px;
/*margin: 50px auto 0 auto;*/
text-align: center;
}
<div id="outer">
<div class="button_slide slide_diagonal">KLIK HIER</div>
</div>
Reason of hiccup
The answer from DreamTeK helped out to point out the issue. It looks like that when a transform transform: translate(-50%,-50%); is applied to #outer, Chrome will hiccup the animation. The only question that will be left is, why does this cause the issue?
edit: typos, extra information
I wasn't able to pinpoint the exact reason Chrome has issues with the box-transition however I used a differant method that creates the same effect much smoother.
#outer {
width: 220px;
margin: 50px auto;
text-align: center;
}
.button_slide {
position: relative;
color: black;
border: 2px solid #ffffff;
padding: 18px 45px;
display: block;
font: 14px "Lucida Console", Monaco, monospace;
letter-spacing: 5px;
text-decoration: none;
cursor: pointer;
transition: ease-out 0.4s;
width: 100%;
box-sizing: border-box;
}
.button_slide::before {
content: '';
box-shadow: inset 0 0 0 0 #fff;
transition: ease-in-out 0.4s;
border: 2px solid #fff;
height: 100%;
width: 100%;
position: absolute;
top: 0;
left: 0;
box-sizing: border-box;
z-index: -1;
}
.slide_diagonal:hover::before {
box-shadow: inset 300px 50px 0 0 #007ACC;
border-color: #007ACC;
}
<div id="outer">
<a class="button_slide slide_diagonal">KLIK HIER</a>
</div>

How to create a css hover effect for show button

I'm a beginner in programming, and I'm trying to create a card with a hover effect. When hovering over the card, I would like to add an opacity to the card and show 4 buttons, one above the other. Can you help me?
Below is my code.
.cardnew {
height : 256px;
text-align : center;
width : 246px;
background : #ffffff;
margin : 20px;
display : inline-block;
box-shadow : 1px 1px 22px rgba(157, 184, 209, 0.19);
border-radius : 1px;
cursor : pointer;
transition : 0.15s linear;
}
.cardnew > img {
height : 150px;
width : 100%;
border-radius : 10px 10px 0 0;
padding : 35px 0 5px 0;
}
.cardnew > h1 {
font-size : 22px;
color : #5c5c5c;
padding : 15px 0 5px 0;
font-weight : 100;
}
.cardnew > p {
font-size : 13px;
color : #cdcdcd;
padding : 0 40px;
line-height : 20px;
}
.cardnew > a {
padding : 13px;
font-weight : normal;
width : 260px;
color : #2687f1;
border : 2px solid #2687f1;
border-radius : 7px;
margin : auto;
margin-top : 35px;
display : block;
transition : 0.2s linear;
}
.cardnew:hover {
transform : scale(1.015);
transition : 0.15s linear;
box-shadow : 1px 1px 22px rgba(157, 184, 209, 0.5);
}
.cardnew:hover > a {
padding : 13px;
width : 260px;
color : #fff;
background : #2687f1;
border-radius : 7px;
margin : auto;
margin-top : 35px;
transition : 0.2s linear;
}
.row-card {
justify-content : space-around;
flex-wrap : wrap;
margin-right : -12.5px;
margin-left : -12.5px;
}
<div class="row-card">
<div class="cardnew">
<img src="https://enginehosting-html.fruitfulcode.com/wp-content/themes/enginehosting-html/assets/images/server.svg" style="padding: 60px 0 5px 0;height: 125px;" />
<h1>
name
</h1>
<p>firstname</p>
<div class="button"> BUTTON
<div class="button"> BUTTON
<div class="button"> BUTTON
<div class="button"> BUTTON
</div>
</div>
I tried some tutorials that I found on MDN and youtube but I couldn't implement it. Any help will be of great help.
can you help me?
like this pen: https://codepen.io/philcheng/pen/YWyYwG
The reason the styling for the buttons wasn't applied is because of all the >s you had. If you remove them, it seems to work a lot better. Also, you have a lot of divs that aren't closed at the bottom. Is there a reason for that?
For the disappearing, you can use the opacity property to make them disappear and reappear on hover.
.cardnew {
height: 256px;
text-align: center;
width: 246px;
background: #ffffff;
margin: 20px;
display: inline-block;
box-shadow: 1px 1px 22px rgba(157, 184, 209, 0.19);
border-radius: 1px;
cursor: pointer;
transition: 0.15s linear;
}
.cardnew img {
height: 150px;
width: 100%;
border-radius: 10px 10px 0 0;
padding: 35px 0 5px 0;
}
.cardnew h1 {
font-size: 22px;
color: #5c5c5c;
padding: 15px 0 5px 0;
font-weight: 100;
}
.cardnew p {
font-size: 13px;
color: #cdcdcd;
padding: 0 40px;
line-height: 20px;
}
.cardnew a {
padding: 13px;
font-weight: normal;
width: 260px;
color: #2687f1;
border: 2px solid #2687f1;
border-radius: 7px;
margin: auto;
margin-top: 35px;
display: block;
opacity: 0;
transition: 0.2s linear;
}
.cardnew:hover {
transform: scale(1.015);
transition: 0.15s linear;
box-shadow: 1px 1px 22px rgba(157, 184, 209, 0.5);
}
.cardnew:hover a {
padding: 13px;
width: 260px;
color: #fff;
background: #2687f1;
border-radius: 7px;
margin: auto;
margin-top: 35px;
opacity: 1;
transition: 0.2s linear;
}
.row-card {
justify-content: space-around;
flex-wrap: wrap;
margin-right: -12.5px;
margin-left: -12.5px;
}
<div class="row-card">
<div class="cardnew">
<img src="https://enginehosting-html.fruitfulcode.com/wp-content/themes/enginehosting-html/assets/images/server.svg" style="padding: 60px 0 5px 0;height: 125px;" />
<h1>
name
</h1>
<p>firstname</p>
<div class="button"> BUTTON
<div class="button"> BUTTON
<div class="button"> BUTTON
<div class="button"> BUTTON
</div>
</div>
EDIT:
I have messed around with your code, and I think I have created something like your picture.
(You might need to mess around with the values to get them perfect.)
.overlay {
background: rgba(0, 0, 0, 0.5);
height: 256px;
width: 246px;
position: absolute;
opacity: 0;
transition: 0.2s linear;
}
.cardnew a {
position: absolute;
padding: 13px;
font-weight: normal;
width: 160px;
color: #2687f1;
border: 2px solid #2687f1;
border-radius: 7px;
margin: auto;
margin-top: 35px;
display: block;
opacity: 0;
transition: 0.2s linear;
}
.cardnew:hover a {
transform: scale(1);
padding: 13px;
color: #fff;
background: #2687f1;
border-radius: 7px;
margin: auto;
margin-top: 35px;
opacity: 1;
transition: 0.2s linear;
}
.btn1 {
top: 10px;
left: 42.5px;
}
.btn2 {
top: 65px;
left: 42.5px;
}
.btn3 {
top: 120px;
left: 42.5px;
}
.btn4 {
top: 175px;
left: 42.5px;
}
.cardnew {
height: 256px;
text-align: center;
width: 246px;
background: #ffffff;
margin: 20px;
display: inline-block;
box-shadow: 1px 1px 22px rgba(157, 184, 209, 0.19);
border-radius: 1px;
cursor: pointer;
transition: 0.15s linear;
}
.cardnew img {
height: 150px;
width: 100%;
border-radius: 10px 10px 0 0;
padding: 35px 0 5px 0;
}
.cardnew h1 {
font-size: 22px;
color: #5c5c5c;
padding: 15px 0 5px 0;
font-weight: 100;
}
.cardnew p {
font-size: 13px;
color: #cdcdcd;
padding: 0 40px;
line-height: 20px;
}
..cardnew:hover {
transform: scale(1.015);
transition: 0.15s linear;
box-shadow: 1px 1px 22px rgba(157, 184, 209, 0.5);
}
.cardnew:hover .overlay {
opacity: 1;
}
.row-card {
justify-content: space-around;
flex-wrap: wrap;
margin-right: -12.5px;
margin-left: -12.5px;
}
<div class="row-card">
<div class="cardnew">
<div class='overlay'>
</div>
<img src="https://enginehosting-html.fruitfulcode.com/wp-content/themes/enginehosting-html/assets/images/server.svg" style="padding: 60px 0 5px 0;height: 125px;" />
<h1>
name
</h1>
<p>firstname</p>
<div class="button"> BUTTON </div>
<div class="button"> BUTTON </div>
<div class="button"> BUTTON </div>
<div class="button"> BUTTON </div>
</div>
</div>
Here is the codepen: click here

1px Solid Border Bottom enables padding on explicit 0 width text input?

I was under the impression that if an element has a set height & width of 0, padding wouldn't push the width/height if the box-sizing is also set to border box, the thing is, this does seem to be the case, but as soon as I add a 1px solid border, the padding gets applied.
div#search > form#sform > a { display: inline-block; width: 20%; }
input#q { width: 80%; display: inline-block; border: 0px; }
div#search > form#sform > a { display: inline; width: 20%; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70' style='width:100%;height:100%' viewBox='0 0 70 70'%3E%3Cg class='base'%3E%3Cg fill='none' fill-rule='evenodd' class='main-fill'%3E%3Cpath d='M33.765 17.294C26.725 17.294 21 23.02 21 30.06c0 7.04 5.725 12.765 12.765 12.765 1.876 0 3.657-.416 5.263-1.146l6.266 9.793c.383.663.871 1.235 1.647 1.235 1.202 0 2.059-.818 2.059-2.059.007-.347-.225-.911-.412-1.235l-6.305-9.857a12.726 12.726 0 0 0 4.246-9.496c0-7.04-5.724-12.765-12.764-12.765zm0 1.647c6.15 0 11.117 4.968 11.117 11.118s-4.967 11.117-11.117 11.117A11.105 11.105 0 0 1 22.647 30.06c0-6.15 4.968-11.118 11.118-11.118z' class='main-fill'/%3E%3C/g%3E%3C/g%3E%3Cstyle%3E.main-fill%7Bfill:%23fff%7D%3C/style%3E%3C/svg%3E"); padding: 13px 10%; background-repeat: no-repeat; background-color: #a03f6e; -webkit-background-size: 50px 50px; -moz-background-size: 50px; -o-background-size: 50px; background-size: 50px; background-position: center center; margin: 0px; height: 40px; position: relative; top: 10px; left: 0px; }
div#search { position: absolute; top: 125px; left: 0; right: 0; margin: auto; width: 100%; max-width: 1200px; z-index: 15; background-color: white; height: 40px; }
div#search:focus, div#search:focus-within { outline: 1px solid #dadada; }
div#search input#q { width: 80%; display: inline; border: 0px; height: 40px; padding-left: 6px; float: left; height: 0px; width: 0px; padding: 0px; padding-left: 10px; border-bottom: 1px solid #aaa; font-size: 20px; font-family: 'Montserrat'; text-align: center; -webkit-box-shadow: inset 0 0 20px 20px white; -moz-box-shadow: inset 0 0 20px 20px white; box-shadow: inset 0 0 20px 20px white; -webkit-transition: 0.2s all ease-in; -o-transition: 0.2s all ease-in; -moz-transition: 0.2s all ease-in; transition: 0.2s all ease-in; }
div#search input#q:focus { outline-offset: 1px; }
input#q:focus { font-weight: 600; color: #444; -webkit-transition: 0.2s all ease-in; -o-transition: 0.2s all ease-in; -moz-transition: 0.2s all ease-in; transition: 0.2s all ease-in; }
div#search input#q::-webkit-input-placeholder { font-size: 14px; }
div#search input#q:-moz-placeholder { font-size: 14px; }
div#search input#q::-moz-placeholder { font-size: 14px; }
div#search input#q:-ms-input-placeholder { font-size: 14px; }
div#search input#q::-ms-input-placeholder { font-size: 14px; }
div#search input#q::placeholder { font-size: 14px; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="search">
<form action="#" method="get" id="sform" name="sform">
<input id="q" type="text" placeholder="Search...">
<a onclick="if ($('#search input#q').val().length > 3) {document.sform.submit()}else if($('input#q').width() == 0){$('#search input').height('40px').animate({width:'80%'},350);}else{$('#search input').focus();}" rel="nofollow"></a>
</form>
</div>
Tick the border-bottom on/off on the input and watch the padding be applied/unapplied
Am I going crazy or is this what should happen? I mean, personally I'd think it'd be the other way round, padding enables border.
Also if it helps, Chrome 68 Win10.

Change image in button on hover

I want to change the image on the button to this white version of it:http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png when hovered on. I thought I would just add a background-image to the :hover but that didn't work. Does anyone know how I can accomplish this? Anything helps, Cheers!
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.button_slidehr {
color: #156466;
border: 1px solid rgba(21,100,102,0.35);
border-radius: 0px;
/* extend left padding */
padding: 18px 15px 18px 62px;
position: relative;
display: inline-block;
font-family: Verdana;
font-size: 14px;
margin-bottom: 20px;
letter-spacing: 1px;
background-color: rgba(255,255,255,0.3);
cursor: pointer;
box-shadow: inset 0 0 0 0 #156466;
-webkit-transition: ease-out 0.4s;
-moz-transition: ease-out 0.4s;
transition: ease-out 0.4s;
}
.slide_downhr:hover {
color:white;
border: 1px solid transparent;
box-shadow: inset 0 100px 0 0 #156466;
}
.button_slidehr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}
.button_slidehr:after {
content: "";
display: inline-block;
position: absolute;
left: 10px;
top: 0;
width: 100%;
height: 100%;
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498058230/HR-Connect-Logo_hjbrmn.png);
background-position: left center;
background-repeat: no-repeat;
background-size: auto 80%;
}
<div class="button_slidehr slide_downhr">Contact HR Now></div>
.slide_downhr:hover:after {
background-image: url(http://res.cloudinary.com/djxai1v1e/image/upload/v1498062883/HR-Connect-Logowhite_fb7duw.png);
}

How to wrap text around a div button?

Can anyone help me with wrapping of the text around the + box ? I can't seem to get it to work. I have a jfiddle that you can refer to. Hope anyone out there can assist me.
Here's the JSFiddle.
And here is the code:
.video-box {
float: left;
width: 31%;
max-width: 240px;
height: 214px;
background: #232323;
margin: 0 1% 2%;
}
.video-box h3 {
display: table-cell;
vertical-align: middle;
margin: 0;
font-size: 1.0em;
line-height: 1.2;
}
.addtoplaylist-videotext:before {
border: solid;
border-color: #222 transparent;
border-width: 6px 6px 0 6px;
bottom: -8px;
content: "";
left: 80%;
position: absolute;
display: inline-block;
z-index: 99;
border-top: 10px solid rgba(0, 0, 0, 0.6);
}
a {
color: #FFFFFF;
}
.video-txt {
position: absolute;
bottom: 0;
right: 0;
font-size: 1.1em;
line-height: 16px;
background: #000;
padding: 0 3px;
color: #fff;
}
.addtoplaylist-videotext {
background-color: #ffffff;
background-color: rgba(0, 0, 0, 0.6);
border-color: rgba(0, 0, 0, 0.6);
border-right-color: #ffffff;
border-radius: 5px;
top: -50px;
color: #ffffff;
left: -100px;
padding: 5px 5px;
position: relative;
z-index: 99;
width: 120px;
height: 15px;
text-align: center;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#1e78a0', endColorstr='#1e78a0');
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
cursor: pointer;
display: none;
}
.viewplaylist-videotext:before {
border: solid;
border-color: #222 transparent;
border-width: 6px 6px 0 6px;
bottom: -8px;
content: "";
left: 80%;
position: absolute;
display: inline-block;
z-index: 99;
border-top: 10px solid rgba(0, 0, 0, 0.6);
}
.viewplaylist-videotext {
background-color: #ffffff;
background-color: rgba(0, 0, 0, 0.6);
border-color: rgba(0, 0, 0, 0.6);
border-right-color: #ffffff;
border-radius: 5px;
top: -50px;
color: #ffffff;
left: -100px;
padding: 5px 5px;
position: relative;
z-index: 99;
width: 120px;
height: 15px;
text-align: center;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0, startColorstr='#1e78a0', endColorstr='#1e78a0');
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
cursor: pointer;
display: none;
}
.addtoplaylist-video:hover .addtoplaylist-videotext {
display: block;
}
.viewplaylist-video:hover .viewplaylist-videotext {
display: none;
}
.title {
color: #FFFFFF;
}
.maintainhere-browse {
float: right;
height: 30px;
margin-left: 3px;
margin-top: 20px;
position: relative;
}
.toggle2 {
position: relative;
float: right;
margin-right: 10px;
margin-top: -15px;
background-color: #f36666;
width: 20px;
height: 18px;
color: #FFFFFF;
font-size: 12px;
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
cursor: pointer;
font-weight: bold;
}
.addtoplaylist-video {
position: relative;
bottom: 0px;
right: 0px;
width: auto;
height: auto;
image-rendering: -moz-crisp-edges;
display: inline-block;
cursor: pointer;
}
.viewplaylist-video {
display: none;
}
}
.addtoplaylist-video a {
color: #FFFFFF !important;
}
.viewplaylist-video a {
color: #FFFFFF !important;
}
.play-ico {
background-position: -2px -1351px;
background: url(/blob/1086/1386905708000/a-ico-sprite-png-data.png) no-repeat -2px -1316px;
text-indent: -9999px;
position: absolute;
top: 0;
left: 0;
width: 33px;
height: 33px;
overflow: hidden;
text-align: left;
}
<div class="video-box">
<div class="video-box-content-holder" data-createtime="1385208101000" data-viewcounts="559">
<div class="img" style="max-height:135px">
<a href="/news/video/typhoon-haiyan-politics/897416.html">
<img src="http://i58.tinypic.com/2uj2o3t.jpg" alt="" width="240" height="135" />
<span class="play-ico">play</span>
<span class="video-txt">01:54</span>
</a>
<span class="add-txt">Asia Pacific</span>
</a>
</div>
<div class="txt-box">
<!-- the class toggle 2 is for 2nd component, diff css-->
<div class="maintainhere-browse">
<div id="browsevideos_1" class="toggle2">
<div class="addtoplaylist-video">
<img src="http://i61.tinypic.com/rtdv2b.png" width="12" height="11" alt="add" class="addplaylisticonimg-browse">
<span class="addtoplaylist-videotext"> Add To Playlist!</span>
</div>
<div class="viewplaylist-video">
<img src="http://i59.tinypic.com/2n98as.png" width="17" height="9" alt="viewicon" class="viewplaylisticonimg-browse">
<span class="viewplaylist-videotext"> View Playlist!</span>
</div>
</div>
</div>
<!--endofmaintainhere-->
<div class="title">
<h3 style="color:white;">Typhoon Haiyan: Politics gets in the way of saving lives i want the text to wrap around </h3>
<span class="date" style="color:white;">23 Nov 2013</span>
</div>
<!-- title -->
</div>
</div>
</div>
So the basic problem is assigning display: table to .video-box h3.
Once that is removed, it actually does wrap. The problem is now that you won't see it with that text, because it so happens that those words would move to the next line anyway. I've added more words and removed the height of the container and you can see this working:
DEMO showing text is wrapping without table-cell property.
In your case, I'd consider rewriting some of the code around positioning the .maintainhere-browse button:
.maintainhere-browse{
...
/*margin-top:20px; Remove this line */
...
}
.toggle2 {
...
margin-top: 10px; /* Changed this value */
...
}
Demo