0

i read that you can just use

.all {
  margin: auto;
  width: 50%;
}

but that doest work for my case because the browser make it auto margin left and right , and it make the width to 50% but it doesnt make my div start from the center. it do that and start in the left ,also all items get messed up. this is my html code

<div class = "all">
        
        <div class="one">
            1
        </div>

        <div class="text">
        Januarry 1 2016
        </div>
    </div>

this is my css code

.all{
    display: inline-block;
    border: 1px groove;
    box-shadow: 5px 5px 10px black; 

}

.one {
    background-color:green;
    color:white;
    font-size: 150px;
    display: inline-block;
    padding-right:120px ;
    padding-left: 120px;
    padding-top:40px;
    padding-bottom:40px;
}


.text {
    font-size:25px;
    text-align: center;
    padding: 30px;

}

so how can i center all of the div (class ("all"))

random
  • 55
  • 1
  • 9
  • Have you had a look at the _many_ questions on this topic? There are two in the Related list at right. [This one](https://stackoverflow.com/questions/396145/how-to-vertically-center-a-div-for-all-browsers?rq=1) may be most relevant. – isherwood Nov 19 '20 at 20:48
  • i want to center it horizontally – random Nov 19 '20 at 20:59

0 Answers0