The size of your div.message is equal to 100% of the div.area minus the left value of 50%. If left is 50%, the width is equal to 50%. At left of 70% the width corresponds to 30% and so on. Nice to have your trick to overcome it :-) Or better doing it with flex or grid...
@LarsLinde3 жыл бұрын
left:0; right:0; margin: 0 auto; would also center the div