1.背景属性

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>05背景相关属性示例</title>
<style>
/* 背景颜色 */
.c0 {
background-color: red;
}
/* 背景图片 */
/*.c1 {*/
/*width: 600px;*/
/*height: 600px;*/
/*border: 1px solid black; !* 边框,1像素,颜色是黑色 *!*/
/*background-image: url("huluwa.png");*/
/*background-repeat: no-repeat; !* 背景图片不平铺 *!*/
/*!*background-position: center; !* 背景图片在中间区域,也可用50% 50% *!*!*/
/*!*background-position: 50% 50%;*!*/
/*background-position: 200px 200px; !* 向x轴和y轴各偏移200像素*!*/
/*}*/ /* 简写上面的.c1 */
.c1 {
width: 600px;
height: 600px;
border: 1px solid black; /* 边框,1像素,颜色是黑色 */
background: url("huluwa.png") no-repeat 50% 50%; /* 简写成一条 */
}
</style>
</head>
<body> <div class="c0">我是div</div> <div class="c1"></div> </body>
</html>

(1)一个鼠标滚动背景图不动的例子

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>06背景不动效果示例</title>
<style> .c1 {
height: 500px;
background-color: red;
} .c2 {
height: 500px;
background: url("huluwa.png") no-repeat center;
background-attachment: fixed; /* 将背景图片固定住,这样在鼠标上限滚动时,这个图片固定住 */
} .c3 {
height: 500px;
background-color: green;
} </style>
</head>
<body> <div class="c1"></div>
<div class="c2"></div>
<div class="c3"></div> </body>
</html>

最新文章

  1. 【原】让H5页面适配移动设备全家 - 设计师篇 - PPT
  2. ps中的位图,矢量图,颜色模式
  3. Monte Carlo 数值积分
  4. ActiveRecord中andFilterWhere使用
  5. 限制Input输入类型的常见代码集合
  6. [原创]大连sap vt 实习生面试经历
  7. POJ 1969
  8. SpringMvc之@RequestParam详解
  9. Leetcode 807 Max Increase to Keep City Skyline 不变天际线
  10. Day03_Python知识总结
  11. PyTorch--双向递归神经网络(B-RNN)概念,源码分析
  12. Effective前端2---加快页面打开速度
  13. 拯救者Y720-gtx1050-window10-配置tensorflow-gpu环境
  14. linux及安全第六周总结
  15. laravel使用when搜索遇到状态参数(有0的状态)的坑
  16. 动手动脑(Java)
  17. 阿里Canal配置(编写中)
  18. python 装饰器的缺点以及解决方法
  19. OCSP
  20. 基于CNN网络的汉字图像字体识别及其原理

热门文章

  1. ImageMagick:用identify得到图片的平均颜色(基本颜色/主色调)
  2. 洛谷 P6602 数轴
  3. FrameworkElementFactory中的SetBinding与SetValue
  4. 解决Django本地接口不能跨域访问的问题
  5. hdu6115 Factory (LCA + 倍增)
  6. linux ssh自动输入密码,expect使用
  7. Hibernate关系映射之many-to-many(多对多)
  8. ElasticSearch实战系列九: ELK日志系统介绍和安装
  9. 关于transition中嵌套keep-alive的问题解决
  10. 4G DTU为什么要具有透传的功能