0

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">
  • What do you want center? The text? – JamesS Jan 30 '23 at 13:47
  • If you are going to ask a CSS question, you need to provide the generated CSS and HTML and not the code used to generated that. [ask] You also need to tag this for whatever you are using for those CSS attributes. This is not a HTML question. – Rob Jan 30 '23 at 14:45

2 Answers2

0

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

Yash Soni
  • 764
  • 3
  • 14
0

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>
compliance
  • 365
  • 7
  • 23