为了在我的网站上使用,我正在尝试使引导卡可点击。 但是,当我用“ ahref”链接包装盒子时,存在很多样式问题。 盒子变小了。我尝试了许多替代方法,但找不到为什么会有问题。
您还可以找到https://codepen.io/snarex/pen/ebQdgj,我对此进行了测试。
section {
padding-top: 4rem;
padding-bottom: 5rem;
background-color: #f1f4fa;
}
.wrap {
display: flex;
background: white;
padding: 1rem 1rem 1rem 1rem;
border-radius: 0.5rem;
box-shadow: 7px 7px 30px -5px rgba(0,0,0,0.1);
margin-bottom: 2rem;
}
.wrap:hover {
background: linear-gradient(135deg,#6394ff 0%,#0a193b 100%);
color: white;
}
.ico-wrap {
margin: auto;
}
.mbr-iconfont {
font-size: 4.5rem !important;
color: #313131;
margin: 1rem;
padding-right: 1rem;
}
.vcenter {
margin: auto;
}
.mbr-section-title3 {
text-align: left;
}
h2 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.display-5 {
font-family: 'Source Sans Pro',sans-serif;
font-size: 1.4rem;
}
.mbr-bold {
font-weight: 700;
}
p {
padding-top: 0.5rem;
padding-bottom: 0.5rem;
line-height: 25px;
}
.display-6 {
font-family: 'Source Sans Pro',sans-serif;
font-size: 1re
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"><link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<section>
<div class="container">
<div class="row mbr-justify-content-center">
<div class="col-lg-6 mbr-col-md-10">
<div class="wrap">
<div class="ico-wrap">
<span class="mbr-iconfont fa-volume-up fa"></span>
</div>
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Stay <span>Successful</span></h2>
<p class="mbr-fonts-style text1 mbr-text display-6">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum</p>
</div>
</div>
</div>
<div class="col-lg-6 mbr-col-md-10">
<div class="wrap">
<div class="ico-wrap">
<span class="mbr-iconfont fa-calendar fa"></span>
</div>
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Create
<span>An Effective Team</span>
</h2>
<p class="mbr-fonts-style text1 mbr-text display-6">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum</p>
</div>
</div>
</div>
<div class="col-lg-6 mbr-col-md-10">
<div class="wrap">
<div class="ico-wrap">
<span class="mbr-iconfont fa-globe fa"></span>
</div>
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Launch
<span>A Unique Project</span>
</h2>
<p class="mbr-fonts-style text1 mbr-text display-6">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum</p>
</div>
</div>
</div>
<div class="col-lg-6 mbr-col-md-10">
<div class="wrap">
<div class="ico-wrap">
<span class="mbr-iconfont fa-trophy fa"></span>
</div>
<div class="text-wrap vcenter">
<h2 class="mbr-fonts-style mbr-bold mbr-section-title3 display-5">Achieve <span>Your Targets</span></h2>
<p class="mbr-fonts-style text1 mbr-text display-6">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum</p>
</div>
</div>
</div>
</div>
</div>
</section>
答案 0 :(得分:0)
您可以尝试使a
标签position: absolute;
像这样...
HTML
<div class="wrap">
<a href="#"></a>
</div>
CSS
.wrap{
position: relative;
}
.wrap a{
position: absolute;
width:100%;
height:100%;
top:0px;
left:0px;
}
a
标记现在位于卡的顶部,并且应根据需要随卡增长和收缩。您还可以将border-radius
添加到a
标签中,以匹配卡片的四角。
我还更新了您的CODEPEN,以便您可以在检查器中查看更改,以更好地了解发生的情况。