-
哆啦的时光机
如果您希望它垂直居中,这应该可以解决问题。.fill { display: flex; align-items: center;}如果您也希望它水平居中,请justify-content像这样添加中心。.fill { display: flex; align-items: center; justify-content: center;}
-
缥缈止盈
所以我建议你研究一下 flex,它可以更轻松地对齐 DOM 中的项目。无论如何,除了回答你的问题之外,你可以将以下代码添加到你的 .fill 类中,它会将其水平和垂直居中。.fill{ display: flex; align-items: center; //To center it vertically justify-content: center; //To center it horizontal }
-
摇曳的蔷薇
干得好:.body { background-image: url(https://media.giphy.com/media/dQtH57ix3NWDKOQeQM/giphy.gif); width: 480px; height: 270px; float: left; border-radius: 20px;}.fill { background-color: #00000d; width: 480px; height: 270px; border-radius: 20px; opacity: .8; /* added these three fields */ display: flex; align-items: center; justify-content: center;}.proxies { margin-left: auto; margin-right: auto;}<html><script src="https://kit.fontawesome.com/5276b58f35.js" crossorigin="anonymous"></script><body class="everything"> <right class="body"> <div class="fill"> <textarea name="proxies" id="proxies" cols="30" rows="10"></textarea> </div> </right></body></html>