[英]How to make a div full sized in CSS?
我無法弄清楚如何正確地為我的 weather-form-div 設置邊距,因為當我嘗試設置邊距時,class App 的 div 會相應移動。 我希望 class App 的 div 的大小是固定的。
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-image: url('https://wallpapercave.com/wp/wp2733241.png');
background-position: center;
background-size: cover;
background-repeat: no-repeat;
min-height: 100vh;
}
.App{
height: 100vh;
width: 100vw;
background: rgba(0,0,0,0.4);
}
.weather-form-div{
border: 4px solid red;
width: 372px;
margin: 50px auto;
}
.weather-form{
display: flex;
flex-direction: column;
}
嘗試使用 flex 屬性,因為 flex 容器擴展項目以填充可用空間或縮小它們以防止溢出
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.