gpt4 book ai didi

html - 我希望我的 3 block 背景在 asp.net 中保持静止

转载 作者:行者123 更新时间:2023-11-28 01:28:57 27 4
gpt4 key购买 nike

我正在开发背景由 3 张图片组成的 asp.net 网络表单;顶部、左侧和右侧。这 3 个部分是从完整图像中裁剪出来的,以适应中间 770 像素宽度的内容主体。目前,当我向下或向上滚动时,这 3 个图像会随着正文内容移动。当我滚动页面时,我希望背景保持静止。我在纯 html 中使用此代码,它适用于单个完整背景图像:

    <head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Layout Example</title>
<link rel="stylesheet" type="text/css" href="./Layout Example_files/style.css">
<style type="text/css">
body{
background: url( "images/SoapBubbles.jpg" ) no-repeat fixed top center;
}
</style>
</head>

我如何在 asp.net 中做到这一点,即使整个背景只有一张图片?

最佳答案

我会使用一个单独的 div 并在其上使用固定定位。示例

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Layout Example</title>
<link rel="stylesheet" type="text/css" href="./Layout Example_files/style.css">
<style type="text/css">
.fixed-background{
background: url( "images/SoapBubbles.jpg" ) no-repeat fixed top center;
position:fixed;
z-index:-1;
top:0;
right:0;
left:0;
bottom:0;
}
</style>
</head>
<body>
<div class="fixed-background"></div>
<div class="content"></div>
</body>

关于html - 我希望我的 3 block 背景在 asp.net 中保持静止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31000128/

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