gpt4 book ai didi

javascript - 如何在 Bootstrap 中使用 img-circle 图像在悬停时添加标题

转载 作者:行者123 更新时间:2023-11-28 07:43:13 26 4
gpt4 key购买 nike

我在 bootstrap 中有一个响应式 ing-circle 链接图像网格,我希望在悬停时显示标题。

我想不出一种方法来做到这一点而不扭曲圆形图像的形状,或者让它出现在圆圈之外。

我的 CSS:

.pic{
-webkit-filter: saturate(50%) opacity(80% ) sepia(15%) grayscale(15%);

}

.pic img{
-webkit-transition: all 0.5s linear;
transition: all 0.5s linear;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}

.pic:hover img{
-webkit-filter: opacity(00% )brightness(120%);
-webkit-transform: scale3d(1.2, 1.2, 1);
transform: scale3d(1.2, 1.2, 1);
}


.circular img {
margin: 0 auto;
border: 6px solid #a9c3b1;
box-shadow: inset 0 0 0 16px rgba(255,255,255,0.6),
0 1px 2px rgba(0,0,0,0.1);
}

img {
display: inline-block;
height: auto;
max-width: 100%;
}




#hatch {
background-image: url("../img/hatch.png");
opacity: 1;

}

#nakashima {
background-image: url("../img/carat.png");
opacity: 1;

}

#areel {
background-image: url("../img/animation.png");
opacity: 1;
}

我试过这方面的变体:

.figcaption {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
border-radius: 50%;
padding: 50% 0;
overflow: hidden;
color: black

opacity: 1;

z-index: 10
}

这是我的 HTML:

div class="row ">

<div class="col-sm-3 col-sm-offset-1">
<div class="circular pic img-circle" id='hatch'>
<h3 class="figcaption">hatch</h3>
<a href="hatch.html"><img src="img/hatch.png" class="img-responsive img-circle" alt="" >
</a>
</div>
</div>

<div class="col-sm-3">
<div class="circular pic img-circle" id='nakashima'>
<a href="hatch.html"><img src="img/carat.png" class="img-responsive img-circle" alt="" >
</a>
</div>
</div>

<div class="col-sm-3">
<div class="circular pic img-circle" id='areel'>
<a href="reel.html"><img src="img/animation.png" class="img-responsive img-circle" alt="">
</a>
</div>
</div>

</div>

预计到达时间:我已经为演示制作了一个 jsfiddle:https://jsfiddle.net/4btssg6y/ 比较第一个添加了文本的圆圈与第二个没有添加文本的圆圈的结果。

最佳答案

嗯,我想我明白了。但我很想听听是否有更好的方法来做到这一点。

HTML:

<section id="design">

<div class="row">

<div class="col-sm-3 col-sm-offset-1">
<div class="circular pic img-circle" id='hatchBkgd'>

<h3>Hatch</h3>

<p>Typography, Print Design</p>
<a href="hatch.html"><img src="http://i.imgur.com/IlW9pin.png" class="img-responsive img-circle fig">
</a>
</div>

</div>

<div class="col-sm-3">
<div class="circular pic img-circle" id='nakashimaBkgd'>

<h3>Nakashima</h3>
<p>Paralax Scrolling Site with SVG animation</p>
<a href="hatch.html"><img src="http://i.imgur.com/Xxg1WaU.png" class="img-responsive img-circle fig" >
</a>
</div>
</div>

<div class="col-sm-3">
<div class="circular pic img-circle" id='areelBkgd'>
<h3>Animation</h3>
<p>Lightwave 3D character design and visual effects</p>
<a href="reel.html"><img src="http://i.imgur.com/bnYtfkB.png" class="img-responsive img-circle fig" alt="">
</a>
</div>
</div>

</div>

</section>

CSS:

@import url('http://getbootstrap.com/dist/css/bootstrap.css');
.pic {
-webkit-filter: saturate(50%) opacity(80%) sepia(15%) grayscale(15%);
}
.pic img {
-webkit-transition: all 0.5s linear;
transition: all 0.5s linear;
-webkit-transform: scale3d(1, 1, 1);
transform: scale3d(1, 1, 1);
}
.pic:hover img {
-webkit-filter: opacity(00%)brightness(120%);
-webkit-transform: scale3d(1.2, 1.2, 1);
transform: scale3d(1.2, 1.2, 1);
}
.circular img {
margin: 0 auto;
border: 6px solid #a9c3b1;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
}
img {
display: inline-block;
height: auto;
max-width: 100%;
}
.fig {
position: relative;
z-index: 100;
}

#hatchBkgd {
background-image: url("http://i.imgur.com/I2mQA0o.png");
opacity: 1;
position: relative;
z-index: 1;

}



#nakashimaBkgd {
background-image: url("http://i.imgur.com/UbID6dY.png");
opacity: 1;
position: relative;
z-index: 1;
}

#areelBkgd {
background-image: url("http://i.imgur.com/b2M3GBX.png");
opacity: 1;
position: relative;
z-index: 1;
}



#design h3{
position: absolute;
z-index: 2;
-webkit-filter: saturate(50%) opacity(80% ) sepia(15%) grayscale(15%);
margin: 0;
margin-top:12vh;
margin-left: 2vw;
color: #fff;
letter-spacing: .1em;
font-weight: 100;
}




#design p{
position: absolute;
z-index: 2;
-webkit-filter: saturate(50%) opacity(80% ) sepia(15%) grayscale(15%);
margin: 0;
margin-top: 17.25vh;
margin-left: 2vw;
color: #fff;
letter-spacing: .1em;
font-weight: 100;
display: block;
border-top: 1px solid white;
padding-right: 3vw;
padding-bottom: 1vw;
}

我更新的 jsfiddle:https://jsfiddle.net/4btssg6y/1/

关于javascript - 如何在 Bootstrap 中使用 img-circle 图像在悬停时添加标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30849921/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com