別のdivの上にdivを配置したいとします。しかし、私は絶対的なポジションを使わずにそれを実装する方法を見つけることができません。ポジションアブソリュートは私のページを非応答にします。私は以下のような効果を得たいと思う。CSS、ホバー、位置絶対および応答エラー
これら2つは、画像を含むdivです。下半透明の黒色は、トランジションとZ-インデックスの変化を伴う背景です。
私は現在、イメージと背景の2つのdivしか持っていません。
jqueryを使用して、ホバーにボタンとフォントサイズを追加する必要がありますか、これを実装する方法はありますか?
HTML:
<div class="col-sm-3 hvr-sweep-to-top">
<img class="img-responsive " src="../images/thumbnailGridImage.jpg" alt="">
</div>
<div class="col-sm-3 hvr-sweep-to-top">
<img class="img-responsive" src="../images/thumbnailGridImage.jpg" alt="">
</div>
CSS:
.hvr-sweep-to-top {
display: inline-block;
vertical-align: middle;
-webkit-transform: translateZ(0);
transform: translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-moz-osx-font-smoothing: grayscale;
position: relative;
-webkit-transition-property: color;
transition-property: color;
-webkit-transition-duration: 0.6s;
transition-duration: 0.6s;
}
.hvr-sweep-to-top:before {
content: "";
position: absolute;
z-index: 20;
top: 60%;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
-webkit-transform: scaleY(0);
transform: scaleY(0);
-webkit-transform-origin: 50% 100%;
transform-origin: 50% 100%;
-webkit-transition-property: transform;
transition-property: transform;
-webkit-transition-duration: 0.6s;
transition-duration: 0.6s;
-webkit-transition-timing-function: ease-out;
transition-timing-function: ease-out;
}
.hvr-sweep-to-top:hover, .hvr-sweep-to-top:focus, .hvr-sweep-to-top:active {
color: white;
}
.hvr-sweep-to-top:hover:before, .hvr-sweep-to-top:focus:before, .hvr-sweep-to-top:active:before {
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
THIS HVR-スワイプ・ツー・トップは、MIT Liscense下hover.cssから抽出された
@PeteはHを添加しましたtmlとcss –