<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
/* 设置背景颜色 */
/* body{
background: yellow;
} */
/* 设置图片作为背景
background-repeat:
no-repeat; 不进行平铺
repeat-y; y轴平铺
repeat-x; x轴平铺
/* 设置图片作为背景 */
/* background-image: url('./images/bj.png'); */
/* 设置背景是否平铺 */
/* background-repeat: no-repeat; */
/* 设置背景的定位 */
/* background-position:50px 100px; */
/* 固定背景位置 */
/* background-attachment:fixed; */
/* 设置背景大小 */
/* background-size:200px 100px ; */
*/
body{
height: 10000px;
/* 设置图片作为背景 */
background-image: url('./images/bj.png');
/* 设置背景是否平铺 */
background-repeat: no-repeat;
/* 设置背景的定位 */
background-position:50px 100px;
/* 固定背景位置 */
background-attachment:fixed;
/* 设置背景大小 */
background-size:200px 100px ;
}
.box{
background: red;
}
</style>
</head>
<body>
<div class="box">
musen123
</div>
</body>
</html>
5、css背景
于 2023-07-14 16:20:31 首次发布