I am working on a site where I have a temporary problem, I have divwith CSS as follows:
.box{
position: absolute;
width: auto;
max-width: 75%;
left: 50%;
transform: translate(-50%,0);
-ms-transform: translate(-50%,0);
-webkit-transform: translate(-50%,0);
background: #000;
color: #fff;
}
Here you can see a simple JSFiddle where it box1works correctly, it has short text and width: auto;works fine ...
But the second block box2has long text and max-width: 75%;, but it does not work correctly, you may notice that its width looks like50%
My question is: where did the box2width come from 50%? And how can I fix this problem?
Thanks in advance
source
share