gpt4 book ai didi

html - 滚动超出顶部或底部时操纵浏览器窗​​口的颜色

转载 作者:行者123 更新时间:2023-12-05 04:15:06 30 4
gpt4 key购买 nike

当我使用触控板滚动时,工具栏和主窗口之间有一个白色间隙(在 THIS IS TOP 标题上方)。你可以在我附上的图片中看到它。只有当我使用触控板(不是鼠标)滚动到窗口底部的顶部或底部以外时,才会出现此间隙。如何设置该背景的颜色超出“正常”窗口?

enter image description here

//当我不滚动时:

enter image description here

    @import url("960_12_col.css");

#header{
background-color: blue;
height: 400px;
margin-top: 80px;
margin-bottom: 30px;
color: white;
padding-left: 50px;
padding-top: 40px;
box-sizing: border-box;
}
.grid_4{
/*
text-align: center;
background-color: red;
margin-top: 30px;
height: 250px;
border: 20px solid black;
box-sizing: border-box;
*/

}
.grid_3{
padding:10px;
border: 5px solid black;
margin: 10px;
height: 140px;
box-sizing: border-box;
}
#comment1{
text-align: left;
}
#comment2{
text-align: center;
}
#comment3{
text-align: center;
}
#comment4{
text-align: right;
}

#leftImage{
}

#centerImage{
}
#rightImage{
}
.image{
text-align: center;
background-color: red;
margin-top: 30px;
height: 250px;
border: 20px solid black;
box-sizing: border-box;

}
.text{
text-align: left;
background-color: #C6E2FF;
margin-top: 5px;
height: 50px;
border: 5px solid black;
box-sizing: border-box;

}
body{
/*
background-image: url("images/kaktus2.jpg");
background-repeat:repeat;
*/

background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#66cccc), to(#336666));
/* Safari 5.1+, Chrome 10+ */
background-image: -webkit-linear-gradient(#336666, #66cccc);
background-attachment: fixed;
/* background-color: red; */

}

#top{
position:fixed;
/*
margin:0px;
*/
top:0px;
left:80px;

right:80px;
*/
text-align: center;
height: 80px;
background-color: magenta;


}
    <!DOCTYPE html>
<html>
<head>
<!-- <link rel="stylesheet" type="text/css" href="css/960_12_col_rtl.css"> -->
<link href="css/custom.css" type="text/css" rel="stylesheet">
</head>
<body>
<div id="top" class="grid_12"> <h1>THIS IS TOP</h1></div>
<div class="container_12 clearfix">
<div id="header" class="grid_12">
<h1>HUHUHUHU</h1>
</div>
<div id="comment1" class="grid_3">
<p>This is comment 1!</p>
</div>
<div id="comment2" class="grid_3">
<p>This is comment 2!</p>
</div>
<div id="comment3" class="grid_3">
<p>This is comment 3!</p>
</div>
<div id="comment4" class="grid_3">
<p>This is comment 4!</p>
</div>

<div class="grid_4 image" >
<p id="image1">image1</p>
</div>
<div class="grid_4 image">
<p id="image2">image2</p>
</div>
<div class="grid_4 image">
<p id="image3">image3</p>
</div>


<div id="underLeftImage" class="grid_4 text">
<p id="underLeftImageText">image3</p>
</div>

<div id="underCenterImage" class="grid_4 text">
<p id="underCenterImageText">image3</p>
</div>
<div id="underRightImage" class="grid_4 text">
<p id="underRightImageText">image3</p>
</div>
</div>
</body>
</html>

最佳答案

在我的测试中(在此 SO 页面上与 Chrome 中的 CSS 检查器混在一起),它基于 body 元素的 background-color

因此,对于页面顶部的绿色栏,您可以这样做:

body {
background-color: green;
}

请注意,它不会继承背景图像,因此如果您希望背景渐变的幻觉继续,那么您需要找到背景图像最顶部像素的颜色并使用它。

关于html - 滚动超出顶部或底部时操纵浏览器窗​​口的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33388549/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com