skip to Main Content

Does anyone know how to center my container to be center. I try to align my code to be center but it doesn’t apply the code. I try to change it but it doesnt work. Do I miss something? It show like this.

I want it to be center but it doesnt work. Here is my html code.

     <div class="row">
        
             <div class="col-md-8" style="margin-top: 30px;">
 
                <div class="card" style="font-size: 100px; text-align: center; height: 100px;">
                    <div class="card-body">
                    </div>
   
                    <div class="card-footer">
                        <div class="row">
                            <div class="col-md-12">

2

Answers


  1. You have applied text-center property on body, but according to screenshot data is on footer

                 <div class="card" style="font-size: 100px; text-align: center; height: 100px;">
                     <div class="card-body">
                     </div>
    
                     <div class="card-footer">
                         <div class="row">
                             <div class="col-md-12">
    

    instead apply style on <div class="card"> check the snippet above

    Login or Signup to reply.
  2. Update:

    I edited your code to a static html to test it out.

    I can see that your code is working, but you can try to add text-align: center; in order to make everything in the container centered.

    Below is the full code, and you can test it here too: https://codesandbox.io/s/festive-hopper-73v528?file=/index.html

    and here’s a live preview: https://73v528.csb.app/

    <div
      class="container"
      style="margin-top: 50px; margin-bottom: 50px; text-align: center;"
    >
      <div class="row">
        <div class="col-md-4">
          <h1>My Uploads</h1>
        </div>
    
        <div class="col-md-4">
          <a
            href="javascript:void(0);"
            class="btn btn-primary"
            onclick="selectFileForUpload();"
            >Upload</a
          >
        </div>
      </div>
    
      <div class="row">
        <div class="col-md-8" style="margin-top: 30px;">
          <div
            class="card"
            style="font-size: 100px; text-align: center; height: 100px;"
          >
            <div class="card-body"></div>
    
            <div class="card-footer">
              <div class="row">
                <div class="col-md-12">
                  <p>chap5</p>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search