◈ Estelle Weyl
→ and → to change slides. 2 for comments. estelle.github.com/cssmastery
◈ Estelle Weyl
background-color
property background-color: white;
background-color: #fff;
background-color: #FFFFFF;
background-color: #FFFFFFFF;
background-color: rgb(255,255,255);
background-color: rgb(100%,100%,100%);
background-color: rgba(255,255,255,1);
background-color: rgba(100%,100%,100%, 1);
background-color: hsl(0, 100%, 100%);
background-color: hsla(0, 100%, 100%, 1);
background-color: transparent;
background-color: currentColor;
Confused? See Colors & Transparency
background-image
propertybackground-image: none | <uri> | inherit
background-image: url(path/aSingleImage.jpg);
Often part of background
shorthand with:
Don't use background
shorthand for risk of setting any of 8 properties to default values
none | [<image>]# | inherit
<image> = <url> | <image()> | <image-set()> | <element()> | <cross-fade()> | <gradient>
background-image: url(green.gif), url(blue.gif);
none | <url> | <gradient> | <image()> | <element()> | <image-set()> | <cross-fade()>
none url(singleImage.png) url(firstImage.jpg), url(secondImage.jpg) url(data:image/gif;base64,fOulrS123hEAAa517sdfQfda...) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='200'><circle cx='55' cy='190' r='25' fill='#FFF' /></svg>"); linear-gradient(to bottom, green, blue) radial-gradient(circle, green, blue)
image('ico_sprite.jpg#xywh=32,64,16,16') image("try1.svg", 'try2.png' , "try3.gif") element('#someID')
See image() notation
url(singleImage.png) url(multipleImages.gif), url(otherGif.gif) url(SVGImages.svg); url(sprite.png#xywh=40,0,20,20) image(sprite.png#xywh=40,0,20,20); url(data:image/gif;base64,fOulrS123hEAAa517sdfQfdafsPFRjuy187xxRM221...) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='200'><circle cx='55' cy='190' r='25' fill='#FFF' />^lt;path d='M160 213h-34a82 82 0 0 0 -82 -82v-34a116 116 0 0 1 116 116z' fill='#666'/><path d='M184 213A140 140 0 0 0 44 73 V 38a175 175 0 0 1 175 175z' fill='#666'/></svg>"); SVG Example
Media fragment will not break backwards... hash will be ignored
Allows the use of any element, including <canvas> where images can be used.
background-image: -moz-element('#someID'); background-image: element('#someID')
Define which portion of the image to show:
background-image: -moz-image-rect(url(ico_sprite.jpg), 32, 64, 16, 16); background-image: image('ico_sprite.jpg#xywh=32,64,16,16')
Fallback in case your images doesn't load:
background-image: image("try1.svg", "try2.png", "try3.gif", blue)
Flip the image if the direction is rtl.
background-image: image("arrow.png" rtl)
background-image: url(myGif.gif), url(otherGif.gif); background-image: none; background-image: linear-gradient(top, red, blue); background-image: url(data:image/gif;base64,fOulrShEAAQ...); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='200'><circle cx='55' cy='190' r='25' fill='#FFF' /></svg>");
background-image: element('#myID'); background-image: image('ico_sprite.jpg#xywh=32,64,16,16'); background-image: image("try1.svg", 'try2.png' , "try3.gif");
background-repeat
propertybackground-repeat:
repeat | repeat-x | repeat-y | no-repeat | space | round;
repeat no-repeat
)no-repeat repeat
)background-repeat: no-repeat;
Should accept 2 values (H & V)
Tip: Include background-repeat: no-repeat;
in your reset CSS
background-attachment
propertybackground-attachment: fixed | local | scroll
background-attachment: scroll
Filet mignon kielbasa pork chop short ribs short loin shank hamburger. Bresaola hamburger venison shankle pork andouille. Pastrami venison andouille pancetta sausage chicken biltong. Tri-tip jerky short loin tenderloin pork chop. Shoulder frankfurter turkey ribeye, jowl tail leberkase brisket sausage boudin ham hock shankle ground round short loin.
background-position
propertyPositioning relative to any corner
background-position: right 50px bottom 50px;
background-clip & background-origin
propertybackground-clip: border-box | padding-box | content-box
background-origin: border-box | padding-box | content-box
background-size: auto | contain | cover | <length>
background-size
background-size: auto | contain | cover | 100px 200px
background
shorthand propertybackground: img position / size repeat attachment origin clip, img position / size repeat attachment box{1,2} bgcolor;
background: url(topImg.jpg) 0 0 / 30px 30px repeat scroll border-box content-box, url(botImg.jpg) 15px 15px / 30px 30px fixed border-box #609;
border-color: white;
border-color: #fff;
border-color: #FFFFFF;
border-color: #FFFFFFFF;
border-color: rgb(255,255,255);
border-color: rgb(100%,100%,100%);
border-color: rgba(255,255,255,1);
border-color: rgba(100%,100%,100%, 1);
border-color: hsl(0, 100%, 100%);
border-color: hsla(0, 100%, 100%, 1);
border-color: transparent;
border-color: currentColor; /* default */
border-width: (length) | thin | medium | thick | inherit {1,4};
border: width style color;
border-left: width style color;
border-top: 5px dashed rgba(217,68,11, 0.8);
border-radius: 0;
border-radius: 20px;
border-radius: 50%;
border-top-left-radius border-top-right-radius border-bottom-right-radius border-bottom-left-radius
DO NOT PREFIX
.circle {border-radius: 50%;}
.oval { border-radius: 50%;}
.different { border-radius: 10px 30px;}
.elliptical { border-radius: 10px / 30px;}
.uglier { border-radius: 10px 35px 20px 15px / 30px 35px 5px 5px;}
border-image: source || slice / width / outset || repeat;
border-style
border-image-source: none | url() | <image> border-image-slice: <number> | XX% {1,4} && fill border-image-width: <length> | XX% | <number> | 1 | auto {1,4} border-image-outset: <length> | <number> {1,4} border-image-repeat: stretch | repeat | round {1,2}
S = W =
border-image: url(gradient.png) 34 / 34px stretch;