簡體   English   中英

在 html 和 css 中如何將 body 設置為屏幕的全尺寸?

[英]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 ,將heightwidth設為 100%。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM