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.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1fd9a-334b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1fd9a-334b8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?