HTML/Html-Css/13-背景属性.html
2023-05-01 19:37:40 +08:00

78 lines
2.0 KiB
HTML

<!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>背景</title>
<style>
html,body {
margin: 0;
min-height: 100vh;
/* 背景色 */
background-color: seagreen;
/* 背景图 */
background-image: url(https://tse2-mm.cn.bing.net/th/id/OIP-C.UM6yunmzITekW0TVUOwSLAHaLl?w=114&h=180&c=7&r=0&o=5&dpr=1.25&pid=1.7);
/* 背景图是否平铺 */
background-repeat: no-repeat;
/* 不平铺 */
/* background-repeat: repeat; 平铺 */
/* background-repeat: repeat-x;
background-repeat: repeat-y; */
/* 平铺某个方向 */
/* 背景定位 */
/* background-position: x y; */
/* background-position: 100px 200px; */
/* background-position: right top;
background-position: right bottom; */
/* background-position: center;
background-position: left top;
background-position:left bottom;
background-position: left center; */
/* 注意: 如果你只给一个值 那么另一个为center */
/* 精灵图 就是用定位这中方式实现的 */
/* 背景图的大小 */
/* background-size:w h; */
/* background-size: auto 600px; */
/* background-size: cover; */
/* 图片一定会沾满容器(盒子), but图片不一定显示的全 */
/* background-size: contain; */
/* 图片一定会显示完整,但是不一定沾满整个容器(盒子) */
/* 背景固定 */
/* background-attachment: fixed; */
/* 固定 */
/* background-attachment: scroll; */
/* 滚动 */
}
</style>
</head>
<body>
</body>
</html>