background属性的复合写法;以及超链接文字上下居中和文字首行缩进
.div1 {
width: 500px;
height: 500px;
background-color: #000000;
/* background-image: url("../HTML/demo04-1.jpg"); */
/* 设置背景图片是否平铺 */
background-repeat: no-repeat;
/*控制背景图片在盒子中的显示位置,如果以数字,x在前,y在后;
如果只有一个数值,则是x,另一个默认center;
当background-attachment: scroll时相对于盒子生效位置
当background-attachment: fixed时相对于整个页面生效位置;*/
background-position: center top;
/* 背景滚动效果,有两个值fixed和scroll,其中fixed是固定,另一个则为随滚动
条而滚动 */
background-attachment: scroll;
/*设置背景颜色的不透明度,并不指背景图片的不透明度*/
background: rgba(0, 0, 0, 0.3);
/*可以使用复合写法进行定义,*/
/* background: url(img/demo04-1.jpg) #f8f8f8 no-repeat fixed right center; */
}
a {
/* 设置超链接以块显示 */
display: block;
/* 设置文字没有下划线 */
text-decoration: none;
text-align: center;
/* line-height: 设置行高,当文本行高与盒子模型高度一致时,一行文字就会垂直居中 */
line-height: 40px;
/* 定义首行缩进 */
/* text-indent: 2em; */
}