<Body>中的背景色未填满整个屏幕

时间:2020-07-02 17:24:56

标签: html css height

我想在首页中设置背景色,所以在正文部分添加了以下几行:

    <head>
<title>Speed_Test_Teleport</title>
</head>
<body style="height:100% ;margin:0 ;padding:0 ;background-color:#C6E2FF;">
<img src="GE_Logo3.png" style="width=350px; height:80px;">
<h1>SpeedTest to:</h1>
<div style="width: 100%; height: 24vh; text-align: center ; color:#8B0000 ; display:inline-block;">
<div style="width: 100%; height: 15px; text-align: center; font-family: palatino ;display: inline-block;"><font size="+3"><b>Teleport,Country </b></font>
 

但是,背景色仅覆盖屏幕的60%;底部充满白色:

Snapshot of results

检查其他帖子后,似乎高度,边距和填充设置为正确的值,但是如您所见,背景颜色只是部分填充了屏幕。

对我所缺少的东西有任何想法吗?

如果需要更多信息,可以在index.html上查看整个代码:

https://github.com/olg33/ST/blob/master/index.html

1 个答案:

答案 0 :(得分:0)

将身高设为100vh,而不是100%。

<body style="height:100vh;margin:0;padding:0;background-color:#C6E2FF;">