当前位置:网站首页>Background fixing effect
Background fixing effect
2022-06-12 08:40:00 【Little boy who likes hot pot】
1.background-attachment Property to set whether the background image is fixed or scrolling with the rest of the page
(1)background-attachment:scroll The background image is scrolling with the object content
(2)background-attachment:fixed The background image is fixed
2. The background image scrolls with the content of the object
Code :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> The background is fixed </title>
<style>
body{
background-image: url(images/bg.jpg);
background-repeat: no-repeat;
background-position: center top;
color: #fff;
font-size: 20px;
}
</style>
</head>
<body>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
</body>
</html>Running effect : Content and picture move at the same time

3. Fixed background image
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> The background is fixed </title>
<style>
body{
background-image: url(images/bg.jpg);
background-repeat: no-repeat;
background-position: center top;
/* Fix the background picture */
background-attachment: fixed;
color: #fff;
font-size: 20px;
}
</style>
</head>
<body>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
<p> The background is fixed </p>
</body>
</html>Running effect : Only the content is moving , Background picture does not move

边栏推荐
- What is the quality traceability function of MES system pursuing?
- Graphic analysis of viewbox in SVG
- Beidou satellite navigation system foundation part 1
- Callback webrtc underlying logs to the application layer
- ASP. Net project development practice introduction_ Item VI_ Error report (summary of difficult problems when writing the project)
- 动态线段树leetcode.699
- Engineers learn music theory (III) interval mode and chord
- Hands on deep learning -- image classification dataset fashion MNIST
- Never use MES as a tool, or you will miss the most important thing
- Adjust SVG width and height
猜你喜欢

Where does the driving force of MES system come from? What problems should be paid attention to in model selection?

Principle and configuration of MPLS

Close asymmetric key

网站Colab与Kaggle

余压监控系统保证火灾发生时消防疏散通道的通畅,为大型高层建筑的安全运行和人民生命财产安全保驾护航

FDA reviewers say Moderna covid vaccine is safe and effective for children under 5 years of age
![[advanced pointer III] implement C language quick sorting function qsort & callback function](/img/f0/3729db83ba3eb15c7df0958858ece9.png)
[advanced pointer III] implement C language quick sorting function qsort & callback function

Regular expressions in JS

ctfshow web4

【进阶指针二】数组传参&指针传参&函数指针&函数指针数组&回调函数
随机推荐
(p17-p18) define the basic type and function pointer alias by using, and define the alias for the template by using and typedef
ctfshow web4
(p21-p24) unified data initialization method: List initialization, initializing objects of non aggregate type with initialization list, initializer_ Use of Lisy template class
R loop assignment variable name
(p15-p16) optimization of the right angle bracket of the template and the default template parameters of the function template
Difference between binary GB and gib
ctfshow web 1-2
Beidou satellite navigation system foundation part 1
What should be paid attention to when establishing MES system? What benefits can it bring to the enterprise?
报错:清除网站内搜索框中的历史记录?
FDA reviewers say Moderna covid vaccine is safe and effective for children under 5 years of age
Oracle installation details (verification)
Production scheduling status of manufacturing enterprises and solutions of APS system
Why should enterprises implement MES? What are the specific operating procedures?
Installation of Shengxin R package
Hands on learning and deep learning -- Realization of linear regression from scratch
处理异常数据
ctfshow web 1-2
判断对象是否为空
根据有效期显示距离当前还剩多少天有效期