Bootstrap 4 Uneven Buttons - html

I have some buttons in a bootstrap 4 list that I set to btn-block but for some reason the last one is a bit wider than the others. I'm not certain why since the CSS that has been added doesn't change the width or anything. Any clues? In the attached pic it's the Instagram button. Code will be below the image.
<header class="construction-header">
<div class="container">
<div class="construction-message">
<h1><img src="http://jessetoxik.com/img/header/logo/logo_temp.png"></h1>
<h3 class="fjalla">Webpage Coming Soon</h3>
<h3 class="release fjalla"></h3>
<hr class="construction-divider">
<ul class="list-inline construction-social-buttons fjalla">
<li class="list-inline-item">
<a href="https://example.com" class="btn btn-secondary btn-lg btn-drk btn-block">
<i class="fa fa-twitter fa-fw"></i>
<span class="network-name">Twitter</span>
</a>
</li>
<li class="list-inline-item">
<a href="https://www.example.com/" class="btn btn-secondary btn-lg btn-drk btn-block">
<i class="fa fa-facebook fa-fw"></i>
<span class="network-name">Facebook</span>
</a>
</li>
<li class="list-inline-item">
<a href="https://www.example.com" class="btn btn-secondary btn-lg btn-drk btn-block">
<i class="fa fa-instagram fa-fw"></i>
<span class="network-name">Instagram</span>
</a>
</li>
</ul>
</div>
</div>
</header>
body, html {
width: 100%;
height: 100%;
}
body, h1, h2, h3, h4, h5, h6 {
font-weight: 700;
text-shadow:
-1px -1px 0 #000,
1px -1px 0 #000,
-1px 1px 0 #000,
1px 1px 0 #000!important;
}
.construction-header {
padding-top: 50px;
padding-bottom: 50px;
text-align: center;
height: 100%;
color: #f8f8f8;
background: url('imagesrc') no-repeat center center;
background-size: cover;
}
.construction-message {
position: relative;
padding-top: 20%;
padding-bottom: 20%;
}
.construction-message>h1 {
margin: 0;
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
font-size: 5em;
}
.construction-divider {
width: 400px;
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.construction-message>h3 {
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
}
.construction-social-buttons i {
font-size: 80%;
}
#media(max-width:767px) {
.construction-message {
padding-bottom: 15%;
}
.construction-message>h1 {
font-size: 3em;
}
ul.construction-social-buttons>li {
display: block;
margin-bottom: 20px;
padding: 0;
}
ul.construction-social-buttons>li:last-child {
margin-bottom: 0;
}
.construction-divider {
width: 100%;
}
}
.btn-drk {
background-color: #232323!important;
}

Without seeing a working sample it's difficult to properly test. One alternative that I found was to use Bootstrap's Grid instead of .list-inline for arranging the buttons. It provides all of the flexibility of their displaying in a single row versus stacked based on the device width.
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<div class="container">
<div class="row">
<div class="col-12 col-sm-4 my-2">
<i class="fa fa-twitter fa-fw"></i><span class="network-name">Twitter</span>
</div>
<div class="col-12 col-sm-4 my-2">
<i class="fa fa-facebook fa-fw"></i><span class="network-name">Facebook</span>
</div>
<div class="col-12 col-sm-4 my-2">
<i class="fa fa-instagram fa-fw"></i><span class="network-name">Instagram</span>
</div>
</div>
</div>

Related

How can I make my app bottom menu full width with html and css?

The mobile version on my website has a bottom navbar menu that looks like an app bottom menu. It looks fine in all devices except in the ones who have 320px width size. In these, the navbar doesn't take the screen's full width but it rather gets cut. (I'm using Bootstrap 4).
This is what it should look like:
This is what's happening in 320px width devices:
This is what it looks like when I add width: 100vw:
My HTML:
// Tablets and Phones (768 and down) //
#media (max-width: 768px) {
.nh-mobile-footer-bottom {
display: flex;
background-color: $white;
height: 78px;
align-items: flex-start;
padding-top: 10px;
box-shadow: 0px -4px 27px rgba(0, 0, 0, 0.1);
-webkit-box-shadow: 0px -4px 27px rgba(0, 0, 0, 0.1);
-moz-box-shadow: 0px -4px 27px rgba(0, 0, 0, 0.1);
}
.nh-mobile-footer-bottom-btn i {
color: $footer-link;
font-size: 1.2em;
}
.nh-mobile-footer-bottom-btn p {
display: block;
color: $footer-link;
font-size: 0.6em;
}
.nh-mobile-footer-bottom-btn-publish-container {
position: relative;
bottom: 40px;
}
.nh-mobile-footer-bottom-btn-publish-container i {
color: $white;
font-size: 1.6em;
padding-top: 16px;
text-align: center;
}
.nh-mobile-footer-bottom-btn-publish {
background-color: $secondary-color;
border-radius: 50%;
width: 56px;
height: 56px;
text-align: center;
}
.nh-mobile-footer-bottom-publish-label {
color: $footer-link;
font-size: 0.6em;
margin-top: 9px;
}
.nh-footer-menu-message-bubble {
background: $error;
border-radius: 0.8em;
color: $white;
display: inline-block;
font-weight: 600;
line-height: 20px;
text-align: center;
width: 20px;
font-size: 14px;
position: relative;
bottom: 3em;
left: 0.8em;
}
}
<!-- Bootstrap 4.5.3 CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<div class="row fixed-bottom nh-mobile-footer-bottom">
<!-- Map -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn pl-4" id="nhMobileMenuMap">
<i class="fal fa-map-marker-alt"></i>
<p>Mapa</p>
</button>
<!-- Filtros -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn" id="nhMobileMenuFilters">
<i class="fal fa-filter"></i>
<p>Filtros</p>
</button>
<!-- Publicar-->
<button type="button" class="btn col nh-mobile-footer-bottom-btn-publish-container" data-toggle="modal" data-target="#publicationServiceModal" id="nhMobileMenuPublishBtn">
<i class="fa fa-plus nh-mobile-footer-bottom-btn-publish"></i>
<p class="nh-mobile-footer-bottom-publish-label">Publicar</p>
</button>
<!-- Mis servicios -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn" id="nhMobileMenuMiServicios">
<i class="fal fa-user-tag"></i>
<p>Mis servicios</p>
</button>
<!-- Messages -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn pr-4" id="nhMobileMenuMessages">
<i class="fal fa-comment"></i>
<p>Mensajes<span class="nh-footer-menu-message-bubble">2</span></p>
</button>
</div>
Used background color & hover effect to show the class cover the area - You can see that by removing *{} or any other CSS to see behavior
Used !important to override the original Bootstrap CSS code
* {
margin: 0px !important;
padding: 0 !important;
overflow:auto !important;
}
.nh-mobile-footer-bottom {
width: 100% !important;
display: block !important;
}
button {
float: left !important;
width: 20% !important;
height: 60px !important;
font-size: 11px !important;
display: block !important;
}
button:hover {
background-color: blue !important;
color: white !important
}
#nhMobileMenuMap {
padding: 0 !important;
}
#nhMobileMenuMessages {
padding: 0 !important;
}
<!-- Bootstrap 4.5.3 CDN -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap#4.5.3/dist/css/bootstrap.min.css" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous">
<div class="row fixed-bottom nh-mobile-footer-bottom">
<!-- Map -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn pl-4" id="nhMobileMenuMap">
<i class="fal fa-map-marker-alt"></i>
<p>Mapa</p>
</button>
<!-- Filtros -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn" id="nhMobileMenuFilters">
<i class="fal fa-filter"></i>
<p>Filtros</p>
</button>
<!-- Publicar-->
<button type="button" class="btn col nh-mobile-footer-bottom-btn-publish-container" data-toggle="modal" data-target="#publicationServiceModal" id="nhMobileMenuPublishBtn">
<i class="fa fa-plus nh-mobile-footer-bottom-btn-publish"></i>
<p class="nh-mobile-footer-bottom-publish-label">Publicar</p>
</button>
<!-- Mis servicios -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn" id="nhMobileMenuMiServicios">
<i class="fal fa-user-tag"></i>
<p>Mis servicios</p>
</button>
<!-- Messages -->
<button type="button" class="btn col nh-mobile-footer-bottom-btn pr-4" id="nhMobileMenuMessages">
<i class="fal fa-comment"></i>
<p>Mensajes<span class="nh-footer-menu-message-bubble">2</span></p>
</button>
</div>

I want to place my icons in the middle of the circle [duplicate]

This question already has answers here:
How can I center text (horizontally and vertically) inside a div block?
(27 answers)
How to vertically align an image inside a div
(37 answers)
How can I vertically align elements in a div?
(28 answers)
Closed 2 years ago.
How can I place my icons in the middle of the circle, based on the following picture:
Here is my HTML code:
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</div>
</footer>
Here is my CSS code that needs to be modified to place the icons in the middle of the white circles:
ul.socialnetworks {
margin: 0;
border:15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks > li {
display: inline-block;
}
ul.socialnetworks > li > a {
display: inline-block;
font-size: 25px;
line-height: 50px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
You can try something like this:
.item{
border-radius:50%;
background-color:black;
border:15px solid white;
width:50px;
height:50px;
display:inline-flex;
}
body{
background-color:black;
}
.item i{
margin-top: 25%;
margin-left: 25%;
color:white;
}
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<div class="item">
<i class="material-icons">add_task</i>
</div>
<div class="item">
<i class="material-icons">add_task</i>
</div>
<div class="item">
<i class="material-icons">add_task</i>
</div>
Icons with class .fab have parameter display: inline-block. This means that vertical-align: middle can be used.
Just add it to your css:
.fab {
vertical-align: middle;
}
ul.socialnetworks {
margin: 0;
border:15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks > li {
display: inline-block;
}
ul.socialnetworks > li > a {
display: inline-block;
font-size: 25px;
line-height: 50px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
.fab {
vertical-align: middle;
}
<script src='https://kit.fontawesome.com/a076d05399.js'></script>
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</ul>
</div>
</footer>
set the line-height equal to height line-height: 58px;
ul.socialnetworks {
margin: 0;
border: 15px;
padding: 0;
width: 100%;
text-align: center;
}
ul.socialnetworks>li {
display: inline-block;
}
ul.socialnetworks>li>a {
display: inline-block;
font-size: 25px;
line-height: 58px;
width: 58px;
height: 58px;
border-radius: 36px;
background-color: #313132;
box-shadow: 0px 0px 2px white;
color: white;
margin: 0 4px 3px 0;
border: 8px solid;
}
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
<footer>
<div class="footer-bg-1">
<h1 class="display-5" style="color: white">Find Me on</h1><br>
<ul class="socialnetworks">
<li>
<a href="https://www.linkedin.com/" title="LinkedIn">
<i class="fab fa-linkedin-in"></i>
</a>
</li>
<li>
<a href="https://github.com/" title="GitHub">
<i class="fab fa-github"></i>
</a>
</li>
<li>
<a href="https://twitter.com/" title="Twitter">
<i class="fab fa-twitter"></i>
</a>
</li>
</div>
</footer>

How can I create a div/button with stacked text inside?

I've been trying to figure out how to produce this in CSS:
However, when I've tried this thus far, it's only partially been on track:
How can I fix the below CSS and HTML so that it works as a stacked text meter properly? I do have Bootstrap, and I'm using SCSS/SASS.
A Pen with the same code, including the full menu, shows the same issue:
https://codepen.io/anon/pen/zLYWZR
.buFontSize {
font-size: 11px;
padding: 0px;
}
.pointButton {
display: block;
border: rgba(255, 255, 255, 0.534) 1px solid !important;
justify-content: center;
padding: 0px !important;
}
.buttonBlock {
display: block;
}
<nav class="navbar navbar-expand navbar-dark">
<div class="navbar" id="navbarText">
<a class="navbar-brand navBrand" href="#">Link One</a>
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#">Link Two</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link Three</a>
</li>
</ul>
<ul class="navbar-nav float-right">
<span class="btn pointButton">
<div class="buttonBlock">
<div class="row">
<span class="buFontSize">Games</span>
</div>
<div class="row">
<span class="buFontSize">100000</span>
</div>
</div>
</span>
<li class="nav-item">
<a class="nav-link" href="#"><i class="fas faSize fa-user-friends"></i></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#"><i class="far faSize fa-envelope"></i></a>
</li>
</ul>
</div>
</nav>
You can use a button group with a br:
body {
background-color: black !important; /* test only */
}
.btn-group .btn {
background: transparent;
color: #ffffff;
border: 1px solid #ffffff;
line-height:1;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" />
<div class="btn-group">
<div class="btn">
Games<br>
10000
</div >
<div class="btn">
Points<br>
000000
</div >
</div>
Example bootply
.buFontSize {
font-size: 11px;
color: #fff;
padding: 0px;
}
.pointButton {
display: block;
border: rgba(255, 255, 255, 0.534) 1px solid;
background: #000;
justify-content: center;
padding: 0px;
}
.buttonBlock {
display: block;
padding: 0px;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet"/>
<span class="btn pointButton">
<div class="buttonBlock">
<div class="row mb-2">
<div class="col-md-12">
<span class="buFontSize">Games</span>
</div>
<div class="col-md-12">
<span class="buFontSize">100000</span>
</div>
</div>
</div>
</span>
try this
body{
background-color: black;
}
.buttonBlock{
float: left;
margin: 0;
padding: 0;
border: 1px solid white;
width: 120px;
text-align: center;
display: inline-block;
color: white;
}
.buttonBlock > span{
display: block;
}
.buttonBlock:first-child{
border-radius: 5px 0 0 5px;
-webkit-border-radius: 5px 0 0 5px;
-moz-border-radius: 5px 0 0 5px;
-ms-border-radius: 5px 0 0 5px;
-o-border-radius: 5px 0 0 5px;
}
.buttonBlock:last-child{
border-radius: 0 5px 5px 0;
-webkit-border-radius: 0 5px 5px 0;
-moz-border-radius: 0 5px 5px 0;
-ms-border-radius: 0 5px 5px 0;
-o-border-radius: 0 5px 5px 0;
}
.buttonBlock:not(:first-child){
border-left: 0;
}
<span class="btn pointButton">
<div class="buttonBlock">
<span class="title">First</span>
<span class="points">100000</span>
</div>
<div class="buttonBlock">
<span class="title">Second</span>
<span class="points">100000</span>
</div>
<div class="buttonBlock">
<span class="title">Third</span>
<span class="points">100000</span>
</div>
<div class="buttonBlock">
<span class="title">Fourth</span>
<span class="points">100000</span>
</div>
<div class="buttonBlock">
<span class="title">Fifth</span>
<span class="points">100000</span>
</div>
</span>
Maybe Use
.somewrapperclass{
display: flex;
flex-flow: wrap row;
align-items: flex-start;
}
Don't use display block as there is a better alternative, check this complete guide to flexbox

How to align icons and fonts with similar margin

I am trying to get my icons and text to have same padding or margin. If you run the code you will see one category is near an icon and other one is far. I want to have consistency. I tried a lot of things but it doesnt reflect anything
.category_nav
{
height: 40px;
margin-top: 38px;
}
.category_nav_ul
{
list-style-type: none;
padding:0;
}
.category_nav_ul > li
{
display: inline-block;
}
#category_nav_ul_category
{
width: 380px;
cursor: pointer;
}
#category_nav_div
{
margin-top: 5px;
width: 380px;
position: absolute;
background-color: white;
padding-bottom: 10px;
}
#categories_content
{
margin-top: 10px;
}
.category_nav_div .content:hover
{
}
.categories
{
list-style: none;
}
.category
{
padding-top: 6px;
padding-bottom: 6px;
margin-bottom: 1px;
border: 0;
border-radius: 0;
}
.category:hover
{
border: 2px;
background:linear-gradient(to right, red 0px, red 3px, transparent 3px);
background-color: white;
border-top: 1px solid grey;
border-bottom: 1px solid grey;
}
.category_icon
{
width: 20px !important;
padding-right: 5px;
background-color: red;
}
.category_content
{
margin-left: 15px !important;
}
.light-border
{
border: 1px solid #e8e8e8;
border-top: none;
}
h2.flash_title
{
color: rgb(120, 120, 120);
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
background: #fff;
color: #666;
font-size: 14px;
padding-left: 19px;
font-weight: 400;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="category_nav_div" class="light-border">
<div class="content" id="categories_content">
<ul class="categories list-group">
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-camera"></i>
</span>
<span class="category_content">
Camera
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-info-circle"></i>
</span>
<span class="category_content">
Clothes
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-mobile"></i>
</span>
<span class="category_content">
Mobiles
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-info-circle"></i>
</span>
<span class="category_content">
Graphics Cards
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-television"></i>
</span>
<span class="category_content">
Television
</span>
</li>
</ul>
</div>
</div>
In i tag you can use a class fa-fw, so all the icons has the same width
Example
<i class="fa fa-television fa-fw"></i>
add this class in all the i tags
.category_nav
{
height: 40px;
margin-top: 38px;
}
.category_nav_ul
{
list-style-type: none;
padding:0;
}
.category_nav_ul > li
{
display: inline-block;
}
#category_nav_ul_category
{
width: 380px;
cursor: pointer;
}
#category_nav_div
{
margin-top: 5px;
width: 380px;
position: absolute;
background-color: white;
padding-bottom: 10px;
}
#categories_content
{
margin-top: 10px;
}
.category_nav_div .content:hover
{
}
.categories
{
list-style: none;
}
.category
{
padding-top: 6px;
padding-bottom: 6px;
margin-bottom: 1px;
border: 0;
border-radius: 0;
}
.category:hover
{
border: 2px;
background:linear-gradient(to right, red 0px, red 3px, transparent 3px);
background-color: white;
border-top: 1px solid grey;
border-bottom: 1px solid grey;
}
.category_icon
{
width: 20px !important;
padding-right: 5px;
background-color: red;
}
.category_content
{
margin-left: 15px !important;
}
.light-border
{
border: 1px solid #e8e8e8;
border-top: none;
}
h2.flash_title
{
color: rgb(120, 120, 120);
font-weight: bold;
text-transform: uppercase;
letter-spacing: 1px;
background: #fff;
color: #666;
font-size: 14px;
padding-left: 19px;
font-weight: 400;
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div id="category_nav_div" class="light-border">
<div class="content" id="categories_content">
<ul class="categories list-group">
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-fw fa-camera"></i>
</span>
<span class="category_content">
Camera
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-fw fa-info-circle"></i>
</span>
<span class="category_content">
Clothes
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-fw fa-mobile"></i>
</span>
<span class="category_content">
Mobiles
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-fw fa-info-circle"></i>
</span>
<span class="category_content">
Graphics Cards
</span>
</li>
<li class="category list-group-item">
<span class="category_icon">
<i class="fa fa-fw fa-television"></i>
</span>
<span class="category_content">
Television
</span>
</li>
</ul>
</div>
</div>
Font-awesome has a class specially to do that. fa-fw
<div class="list-group">
<a class="list-group-item" href="#"><i class="fa fa-home fa-fw" aria-hidden="true"></i> Home</a>
<a class="list-group-item" href="#"><i class="fa fa-book fa-fw" aria-hidden="true"></i> Library</a>
<a class="list-group-item" href="#"><i class="fa fa-pencil fa-fw" aria-hidden="true"></i> Applications</a>
<a class="list-group-item" href="#"><i class="fa fa-cog fa-fw" aria-hidden="true"></i> Settings</a>
</div>
http://fontawesome.io/examples/

Centre an Icon within a div - Bootstrap 3 & Font Awesome

I have a simple bootstrap grid with a row displaying some text in one column and a stacked font-awesome icon set in another column. The issue I'm having is the icon-set is not vertically aligned in the middle of the div, as the text is. As you can see the icon is more aligned to the top of the div. Is there a way to center align this?
I've created a fiddle here and re-posted the code below:
html:
<div class="container-fluid">
<div class="row posted-content">
<div class="col-md-10">
<h4 class="text-primary pull-left">Hey, this is some text</h4>
</div>
<div class="col-md-2 comment-count pull-right">
<a class="fa-stack comment-action">
<i class="fa fa-comment-o fa-fw fa-stack-2x"></i>
<i class="fa fa-stack-1x">5</i>
</a>
</div>
</div>
</div>
css:
.posted-content {
border-radius: 4px;
border-color: #e7e7e7;
border: 1px solid rgba(0, 0, 0, 0.1);
max-width: 1140px;
background-color: #f8f8f8;
margin-bottom: 0px;
vertical-align: middle;
}
I've tried playing with vertical-align but to no avail. Any ideas appreciated.
Try this
<div class="container-fluid">
<div class="row posted-content centered-vertically">
<div class="col-md-10">
<h4 class="text-primary pull-left">Hey, this is some text ghssd fjkflsdj sdfkkl;asdk</h4>
</div>
<div class="col-md-2 comment-count pull-right">
<a class="fa-stack comment-action">
<i class="fa fa-comment-o fa-fw fa-stack-2x"></i>
<i class="fa fa-stack-1x">5</i>
</a>
</div>
</div>
</div>
CSS
.container-fluid .centered-vertically{
display:flex;
align-items:center;
}
Fiddle here
Here is a little Workaround with flexbox:
.posted-content {
border-radius: 4px;
border-color: #e7e7e7;
border: 1px solid rgba(0, 0, 0, 0.1);
max-width: 1140px;
background-color: #f8f8f8;
margin-bottom: 0px;
display:flex;
align-items: center;
justify-content: space-between;
}
.posted-content:before,.posted-content:after{
display:none;
}
.comment-action {
color: #79858A;
}
.comment-count>a {
text-decoration: none;
}
.comment-count>a:hover {
color: #d9534f !important;
}
JSFiddle