Top Banner
css background images
14
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CssBackgroundImages

css  background  images  

Page 2: CssBackgroundImages

Box  model  

Page 3: CssBackgroundImages

Each box has a background layer that may be fully transparent (the default), or filled with a color and/or one or more images. The background properties specify what color (‘background-color’) and images (‘background-image’) to use, and how they are sized, positioned, tiled, etc. The background properties are not inherited, but the parent box's background will shine through by default because of the initial ‘transparent’ value on ‘background-color’.

Page 4: CssBackgroundImages

Sets the background color to red.

{ background-color: #f00; }

Page 5: CssBackgroundImages

sets the background color to red. superimposes the image over the background and tiles it (repeat) to fill the space.

{ background-color: #f00; background-image: url(flower.png); }

Page 6: CssBackgroundImages

Sets the background color to red. Superimposes the image over the background and tiles it (repeat) to fill the space. Image is not repeated.

{ background-color: #f00; background-image: url(flower.png); background-repeat: no-repeat; }

Page 7: CssBackgroundImages

Sets the background color to red. Superimposes the image over the background and tiles it (repeat) to fill the space. Image is not repeated. Single image is aligned center top in container.

{ background-color: #f00; background-image: url(flower.png); background-repeat: no-repeat; background-position:center top; }

Page 8: CssBackgroundImages

How  did  they  do  it?  http://bradcolbow.com/

Page 9: CssBackgroundImages

element { background-color: color || #hex || (rgb / % || 0-255); background-image:url(uri); background-repeat: repeat || repeat-x || repeat-y || no-repeat; background-position: x y || (top||bottom||center) (left||right||center); background-attachment: scroll || fixed;

Page 10: CssBackgroundImages

{ background: red url(image.png) repeat top left scroll; }

Page 11: CssBackgroundImages

sets multiple background images on one item

{ background: url(image_1.png) top left no-repeat, url(image_2.png) bottom left no-repeat, url(image_3.png) bottom right no-repeat; }

Page 12: CssBackgroundImages

Check out quirksmode.org for compatibility issues. http://www.quirksmode.org/css/contents.html

Page 13: CssBackgroundImages

CSS based background image which is clickable and which turns into a text link if CSS is not supported.

<a href=“#” id=“link” >some text</a>

#link { background: url(image_1.extention) top left no-repeat; display:inline-block; height:100px; width:200px text-indent:-9999px; }

Page 14: CssBackgroundImages

links  Perfect Full Page Background Image http://css-tricks.com/perfect-full-page-background-image/