Reputation: 777
Hi guys I am trying to create a circle around my fa icons , example of this :
I have made everything apart from the circle border and i have no idea how to get this effect to work , i have this so far :
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%;
}
The only part i cant get to work is the radius around the icon
Thanks for the help
Upvotes: 0
Views: 298
Reputation: 26
It is probably better to style a parent container than the icon itself (see icon-container class). I moved the width, height, and border radius to the parent container and then used translate to center the icon in the circle. Hope this helps!
.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>
Upvotes: 1
Reputation:
Add a class of circle
around your containers and the CSS has been demonstrated below. Hope, this helps :)
.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%;
}
<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>
Upvotes: 1