如何让网页背景图片完整显示
2015-06-11 16:10
92 查看
在给网页加背景图时会遇到:图片过大,只能显示出部分,不能完整的显示出来,实现不了设计的效果,怎么办?
View Code
background:url(images/hi-wifi-bg.jpg) no-repeat center center; background-size:100% 100%;
背景图片的定位background-position设为center center(x,y)
background-size规定背景图像的尺寸,默认值是auto,
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> body{ background:url(images/hi-wifi-bg.jpg) no-repeat center center; background-size:100% 100%; } </style> </head> <body> <p style=" width:100px; height:1000px;background:#000; opacity:0.5;"> </p> </html> </body> </html>
View Code
background:url(images/hi-wifi-bg.jpg) no-repeat center center; background-size:100% 100%;
背景图片的定位background-position设为center center(x,y)
background-size规定背景图像的尺寸,默认值是auto,
语法
background-size: length|percentage|cover|contain;
相关文章推荐
- Android相关网站
- 怎么样才能成为一个软件工程师开发高手?
- 黑马程序员——Java基础---网络编程(TCP编程)
- django类视图浅析
- UNIX下的LD_PRELOAD环境变量
- JQuery学习系列1
- Linux C 编程内存泄露检测工具:memwatch
- android 按钮置灰效果
- Mac android 开发 sdk配置和手机连接
- SQL 查找表名 字段名
- java实现图片与base64字符串之间的转换
- extern与头文件(*.h)的区别和联系
- 东莞理工学院好吗?
- Linux压缩解压命令大全
- 一个11G 抓没有绑定变量的语句.非常好!非常精确,非常快.
- js获取url的参数的正则方式
- [python]文件操作read&readline&readlines
- 剑指offer-第三章高质量的代码(调整数组顺序使得奇数位于偶数的前面)
- 网页 css 样式 初始化
- 养成写博客的好习惯,记录学习过程中的点滴和收藏不错的东西