[英]How do you set the body to the full size of the screen in html and css?
我的代碼中的正文有點偏離屏幕的左側和頂部,我嘗試刪除content-box
並刪除邊距,但它不起作用。 我也試過絕對定位它left:0;
和top:0;
但這些都不起作用,這是我的代碼;
body { padding: none; margin: none; box-sizing: border-box; position: absolute; top: 0; left: 0; width:100%; height: 100vh; border: 2px solid red; }
沒關系。 我通過簡單地改變margin:none;
來解決這個問題。 , 到margin:0;
.
在CSS
,將height
和width
設為 100%。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.