大家好我想在我的fa图标周围创建一个圆圈,例如:
我已将所有内容与圆形边框分开,我不知道如何使此效果起作用,我到目前为止:
HTML:
<div class="row icon-set">
<div class="col-md-3 text-center">
<p>
<i class="fa fa-lightbulb-o"></i>
</p>
<p class="title"><span class="underline-text">Awesome</span>
</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</div>
</div>
CSS:
.parrlex1 .underline-text {
border-color: rgba(239,239,239,.5);
border-bottom-style: solid;
display: inline-block;
border-bottom-width: 3px;
padding-bottom: 7px;
}
.parrlex1 .title {
color: #ccb08a;
margin-top: 28px;
margin-bottom: 10px;
letter-spacing: 2px;
text-align: center;
text-transform: uppercase;
font-weight: 700;
}
.icon-set .fa-lightbulb-o {
font-size: 40px;
width: 100%;
height: 100%;
border-radius: 50%;
}
我唯一无法工作的部分是图标周围的半径
感谢您的帮助
答案 0 :(得分:1)
在容器周围添加一类circle
,下面演示了CSS。希望,这有助于:)
.parrlex1 .underline-text {
border-color: rgba(239, 239, 239, .5);
border-bottom-style: solid;
display: inline-block;
border-bottom-width: 3px;
padding-bottom: 7px;
}
.parrlex1 .title {
color: #ccb08a;
margin-top: 28px;
margin-bottom: 10px;
letter-spacing: 2px;
text-align: center;
text-transform: uppercase;
font-weight: 700;
}
.circle {
display: block;
height: 100px;
width: 100px;
line-height: 100px;
border-radius: 50%;
border:1px solid gold;
background-color: rgba(10,10,10,0.8);
color: gold;
text-align: center;
font-size: 2em;
}
.icon-set .fa-lightbulb-o {
font-size: 40px;
width: 100%;
height: 100%;
border-radius: 50%;
}
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<div class="row icon-set">
<div class="col-md-3 text-center">
<p class="circle">
<i class="fa fa-lightbulb-o"></i>
</p>
<p class="title"><span class="underline-text">Awesome</span>
</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</div>
</div>
&#13;
答案 1 :(得分:1)
设置父容器的样式可能比图标本身更好(请参阅icon-container类)。我将宽度,高度和边框半径移动到父容器,然后使用translate将图标置于圆圈中心。希望这有帮助!
.underline-text {
border-color: rgba(239, 239, 239, .5);
border-bottom-style: solid;
display: inline-block;
border-bottom-width: 3px;
padding-bottom: 7px;
}
.title {
color: #ccb08a;
margin-top: 28px;
margin-bottom: 10px;
letter-spacing: 2px;
text-align: center;
text-transform: uppercase;
font-weight: 700;
}
.icon-container {
position: relative;
width: 200px;
height: 200px;
border: 2px solid red;
border-radius: 50%;
margin: auto;
}
.icon-set .fa-lightbulb-o {
font-size: 40px;
position: absolute;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
}
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<div class="row icon-set">
<div class="col-md-3 text-center">
<p class="icon-container">
<i class="fa fa-lightbulb-o"></i>
</p>
<p class="title"><span class="underline-text">Awesome</span>
</p>
<p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p>
</div>
</div>