-1

I can't seem to center text in a boostrap column. I've tried "align-items-center", margin o auto and display: table etc and not sure why I can't get it to work? I've looked at several similar questions here also to no avail?

 .fakeimg {
    height: 200px;
    background: #aaa;
  }

  #fake {
        margin: 0 auto;
        text-align: center
<div class="container" style="margin-top:30px">
  <div class="row align-items-center">

    <div class="col-sm-8">
       <div id="fake" class="fakeimg">Center me vertically please</div>

</div>

quietplace
  • 471
  • 1
  • 4
  • 14

1 Answers1

0

Are you looking something like this?

   #fake {
        margin: 0 auto;
        text-align: center;
        background: lightgreen;
        color:white;
        height: 200px;
        display: flex;
        justify-content: center;
        align-items: center;
        }
<div class="container" style="margin-top:30px">
  <div class="row align-items-center">

    <div class="col-sm-8">
    <div id="fake" class="fakeimg">Center me vertically please</div>
   </div>
   </div>
</div>
akhtarvahid
  • 9,445
  • 2
  • 26
  • 29