我在页面上有3个带翻转效果的框,当有人鼠标悬停在框上时,它会将内容从段落更改为带有“查看更多”按钮的无序列表。
问题是每个框在列表中有不同数量的项目,并且按钮在列表的末尾对齐,我试图将其对齐到框的最底部。
我已经尝试了一些建议,我发现通过这些论坛,但仍然无法使其工作。有人能直接指出我吗?我错过了什么吗?
页面在下面,理想情况下我想将所有按钮对齐到底部,与按钮出现在第一个框中的位置相同。
http://wpdev.quadris.co.uk/what-we-do/
我正在使用的位代码如下
.box {
cursor: pointer;
height: 340px;
position: relative;
overflow: hidden;
width: 100%;
}
.box .fa {
position: relative;
margin-top: 40%;
left: 43%;
font-size: 48px;
}
.box h2 {
text-align: center;
position: absolute;
font-size: 24px;
left: 5%;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box p{
text-align: center;
position: relative;
top: 30%;
padding: 3%;
padding-top: 0;
}
.box .overbox p {
text-align: center;
color: #fff;
font-size: 16px;
}
.box .overbox {
background-color: #424545;
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 100%;
height: 340px;
padding: 30px 20px;
}
.box:hover .overbox { opacity: 1; }
.box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box .title {
font-size: 16px;
text-transform: none;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.box:hover .title,
.box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.box .tagline {
font-size: 0.8em;
color:#fff;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.box:hover .tagline,
.box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
color: #fff;
}
.box .overbox .btn-primary {
position: relative;
bottom: 0;
background-color: #9e3039;
color: #fff;
border-style: none;
}
.box .overbox .btn-primary a, a:hover {
color: #fff;
}
<div class="box"> <h2>Managed IT Solutions</h2>
<p>No matter what your IT requirement is, we can help.
Whether you are looking for a fully managed IT service or one tailored to supplement your internal team, we have a solution for you.
</p>
<i class="fa fa-gg"></i>
<div class="overbox">
<div class="title overtext">
<ul>
<li>Tailored IT Support</li>
<li>Service Desk</li>
<li>Networking Monitoring</li>
<li>Managed Disaster Recovery</li>
<li>IT PRocurement</li>
<li>Managed Security</li>
<li>Co-Location Services</li>
<li>Hosted Services</li>
<li>Domain Management</li>
<li>Security Vulnerability Scanning</li>
</ul>
<div class="tagline overtext"><button type="button" class="btn btn-primary btn-lg btn-block"><a href="#">Find Out More</a></button> </div>
</div>
</div>
</div>
非常感谢任何帮助。
谢谢,
PhilB
答案 0 :(得分:2)
将height:90%
设置为您的班级.text
,这会将您的按钮放在.overbox
的底部。
.box .title {
font-size: 16px;
text-transform: none;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
height: 90%; /*Add this*/
}
答案 1 :(得分:0)
请参阅下面的代码段。
要让button
保持在.overbox
的最底部,根据overbox
。所述,您需要将其停留在HTML中,移动div
包含button
中的.overtext
,并将其作为overbox
的直接子项。
然后将position: absolute
设置为包含div
(button
)和tagline
或bottom:0
的{{1}},因为我已在下面的片段(所以它不完全在底部)
bottom:5px
&#13;
.box {
cursor: pointer;
height: 340px;
position: relative;
overflow: hidden;
width: 100%;
}
.box .fa {
position: relative;
margin-top: 40%;
left: 43%;
font-size: 48px;
}
.box h2 {
text-align: center;
position: absolute;
font-size: 24px;
left: 5%;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
}
.box p{
text-align: center;
position: relative;
top: 30%;
padding: 3%;
padding-top: 0;
}
.box .overbox p {
text-align: center;
color: #fff;
font-size: 16px;
}
.box .overbox {
background-color: #424545;
position: absolute;
top: 0;
left: 0;
color: #fff;
z-index: 100;
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
opacity: 0;
width: 100%;
height: 340px;
padding: 30px 20px 80px;
box-sizing:border-box;
}
.box:hover .overbox { opacity: 1; }
.box .overtext {
-webkit-transition: all 300ms ease-out;
-moz-transition: all 300ms ease-out;
-o-transition: all 300ms ease-out;
-ms-transition: all 300ms ease-out;
transition: all 300ms ease-out;
transform: translateY(40px);
-webkit-transform: translateY(40px);
}
.box .title {
font-size: 16px;
text-transform: none;
opacity: 0;
transition-delay: 0.1s;
transition-duration: 0.2s;
}
.box:hover .title,
.box:focus .title {
opacity: 1;
transform: translateY(0px);
-webkit-transform: translateY(0px);
}
.box .tagline {
font-size: 0.8em;
color:#fff;
opacity: 0;
transition-delay: 0.2s;
transition-duration: 0.2s;
}
.box:hover .tagline,
.box:focus .tagline {
opacity: 1;
transform: translateX(0px);
-webkit-transform: translateX(0px);
color: #fff;
}
.box .overbox .tagline {
position:absolute;
bottom: 5px;
background-color: #9e3039;
color: #fff;
border-style: none;
}
.box .overbox .tagline .btn-primary{
background-color: #9e3039;
}
.box .overbox .btn-primary a, a:hover {
color: #fff;
}
&#13;