SBB SBB - 1 year ago 106
CSS Question

Bootstrap CSS Styling troubles

I have a small piece of bootstrap code I am working with to style my

elements inside a
. I am trying to get the icon on the left and the buttons on the right to be centered both vertically and horizontally. The content it self I would like to be centered vertically.

<div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-cubes"></i>&nbsp;&nbsp;Modules</div>
<br />
<div class="list-group">
<a class="list-group-item">
<div class="media col-md-3">
<figure class="">
<center><i aria-hidden="true" class="fa fa-cog fa-6"></i></center>
<div class="col-md-6">
<h4 class="list-group-item-heading"> Module Title </h4>
<p class="list-group-item-text"> Qui diam libris ei, vidisse incorrupte at mel. His euismod salutandi dissentiunt eu. Habeo offendit ea mea. Nostro blandit sea ea, viris timeam molestiae an has. At nisl platonem eum.
Vel et nonumy gubergren, ad has tota facilis probatus. Ea legere legimus tibique cum, sale tantas vim ea, eu vivendo expetendis vim. Voluptua vituperatoribus et mel, ius no elitr deserunt mediocrem. Mea facilisi torquatos ad.
<div class="col-md-3">
<div class="input-group">
<div id="radioBtn" class="btn-group">
<button class="btn btn-primary btn-sm active" data-toggle="happy" data-title="Y">YES</button>
<button class="btn btn-primary btn-sm notActive" data-toggle="happy" data-title="N">NO</button>
<input type="hidden" name="happy" id="happy">


a.list-group-item {
} small {
font-size: 60px;
vertical-align: middle;
#radioBtn .notActive{
color: #3276b1;
background-color: #fff;

What I have tried: With my little knowledge of CSS, I was trying to align the elements using vertical align and couldn't get them to move. I tried using center tags around the buttons and those wouldn't move either. I have a feeling the
styling is overwriting some of the things I am trying and its throwing me off.

Any thoughts?

Here is an example of what I am trying to do:

enter image description here

JS Fiddle:

Answer Source

For your Problem you can simply add this to your css

    border-width: 0px 0px !important;

.vertical-center {
    min-height: 100%;  /* Fallback for browsers do NOT support vh unit */
    min-height: 100vh; /* These two lines are counted as one :-)       */
    display: flex;
    align-items: center;

To reach a vertical center alignment add vertical-center to each list-group-item