免费图片
- http://foter.com
- https://unsplash.com
- http://www.morguefile.com
- http://www.freeimages.com
- http://openphoto.net
- http://search.creativecommons.org
- http://www.flickr.com/creativecommons
- ICON: http://www.flaticon.com
- ICON: http://www.somerandomdude.com/work/sanscons/
- Tiling patterns: http://www.colourlovers.com/patterns
- Tiling patterns: http://www.kollermedia.at/pattern4u
- Tiling patterns: http://squidfingers.com/patterns
- Tiling patterns2: http://bgpatterns.com
- Tiling patterns2: http://stripegenerator.com
- Tiling patterns2: http://patterncooler.com
<img>
标签
<img>
最常用的属性: border padding float margin border-radus
作为背景的图片
|
|
GIF JPEG PNG SVG
- GIF (Graphics Interchange Format): 动态图
- JPEG(Joint Photographic Experts Group): 色彩丰富, 适于照片
- PNG (Portable Network Graphics)
- png8 取代gif;
- png24, png32比jpeg色彩更丰富,但体积更大;
- png提供alpha通道;
- SVG (Scalable Vector Grphic)
控制重复
|
|
round
使图片变形来填满背景(下图左);space
不变形图片, 在重复图片间填充space来铺满背景(下图右).
定位背景图片
简单定位
|
|
固定图片位置(不滚动)
|
|
背景的原点和裁剪
|
|
缩放背景图片
|
|
contain
: forces the image to resize to fit the background space of the page element while maintaing the aspect ratio of the image.cover
: forces the width of the image to fit the width of the element and the height of the image to fit the height of the element, without changing the aspect of the image.
Background 属性速记法
|
|
为滚动设置多个背景图片
|
|
渐变背景
线性渐变
|
|
重复线性渐变
|
|
径向渐变
|
|
重复径向渐变
|
|