Reputation: 195
I have a li with a p tag which only displays when you hover the li but I can't get a transition between that, How can I do that? Maybe it is only possible whit jquery of javascript, I don't know how I can fix this anyway
<ul class="promo-line two">
<li>
<p>36%</p>
</li>
<li>
<p>45%</p>
</li>
<li>
<p>50%</p>
</li>
</ul>
And:
* {margin:0;padding:0;}
.promo-line.two li:nth-child(1) {
background: red;
}
.promo-line.two li:nth-child(2) {
background: blue;
}
.promo-line.two li:nth-child(3) {
background: yellow;
}
.promo-line li p {
display: none;
transition: all 1s ease-in-out;
}
.promo-line li:hover > p {
display: block;
background: rgba(0,0,0,0.5);
color: white;
width: 314px;
height: 180px;
line-height: 180px;
text-align: center;
font-size: 25px;
box-shadow: inset 5px 5px 40px black;
}
.promo-line li {
position: relative;
width: 314px;
height: 180px;
margin: 0 0 0 4px;
float: left;
background: purple;
}
Upvotes: 0
Views: 61
Reputation: 1889
See http://jsfiddle.net/GB4QL/2/
You need to use opacity
property instead of display
* {margin:0;padding:0;}
.promo-line.two li:nth-child(1) {
background: red;
}
.promo-line.two li:nth-child(2) {
background: blue;
}
.promo-line.two li:nth-child(3) {
background: yellow;
}
.promo-line li p {
opacity: 0;
background: rgba(0,0,0,0.5);
color: white;
width: 314px;
height: 180px;
min-height:180px;
line-height: 180px;
text-align: center;
font-size: 25px;
box-shadow: inset 5px 5px 40px black;
transition: all 1s ease-in-out;
}
.promo-line li:hover > p {
opacity: 1;
}
.promo-line li {
position: relative;
width: 314px;
height: 180px;
margin: 0 0 0 4px;
float: left;
background: purple;
}
Upvotes: 2