How to use css to make a div pop-up box highly adaptive to the content

if the premise height is not set or auto,min-heigth is not suitable, there will be a blank at the bottom.

.errors
{
    width: 390px;
    min-height: 210px;
    background:white;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 120px;
    z-index: 100;
    margin: 150px auto;
    color: black;
}

clipboard.png

Dec.23,2021

location attribute. The two attributes corresponding to top,left,right,bottom, are location, and three or four attributes are equivalent to setting width and height attributes. So remove the bottom, or top, attributes


remove bottom:0


add a transform: translate (- 50%,-50%);


feel that the code you posted does not correspond to your screenshot.

Menu