css--背景 属性
2018-08-24 本文已影响0人
3e0a50393df8
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>简写背景属性</title>
<style type="text/css">
body{
height: 5000px;
/*设置一个背景颜色*/
/*background-color: #bfa;*/
/*设置一个背景图片*/
/*background-image: url(img/3.png);*/
/*设置背景不重复*/
/*background-repeat: no-repeat;*/
/*设置背景图片的位置*/
/*background-position: center center;*/
/*设置背景图片不随滚动条滚动*/
/*background-attachment: fixed;*/
background-color: #bfa;
/*background
- 通过该属性可以同时设置所有背景相关的样式
- 没有顺序的要求,谁在前睡在后都行
- 也没有数量的要求,不写的样式就使用默认值
*/
background: #bfa url(img/3.png) center center no-repeat fixed;
}
</style>
</head>
<body>
</body>
</html>