forked from jgthms/css-reference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackgrounds.html
More file actions
1 lines (1 loc) · 40.1 KB
/
Copy pathbackgrounds.html
File metadata and controls
1 lines (1 loc) · 40.1 KB
1
<section id="background-attachment" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-attachment/" data-property-name="background-attachment" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-attachment">Share</a> <a target="_blank" href="http://caniuse.com/#feat=background-attachment" data-tooltip="See on Can I use..." rel="external">Can I use</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-attachment" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-attachment"><span>#</span>background-attachment</a></h2><div class="property-description"><p>Defines <em>how</em> the background image will behave when scrolling the page.</p></div></header><style type="text/css">.background-attachment { background-image: url(/images/landscape.jpg);background-position: center center;background-size: cover;height: 200px; }</style><style type="text/css">.background-attachment p { background: white;padding: 0.8em 1em; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-attachment: scroll;">background-attachment: scroll;</code></p><div class="example-description"><p>The background image will scroll with the page. It will also position and resize itself according to the element it's applied to.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-attachment" id="background-attachment-scroll"><p>Hello world</p></div></div></aside><style type="text/css">#background-attachment-scroll{ background-attachment:scroll;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-attachment: fixed;">background-attachment: fixed;</code></p><div class="example-description"><p>The background image will <em>not</em> scroll with the page, and remain positioned according to the viewport. It will also position and resize itself according to the viewport. As a result, the background image will probably only be partially visible.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-attachment" id="background-attachment-fixed"><p>Hello world</p></div></div></aside><style type="text/css">#background-attachment-fixed{ background-attachment:fixed;}</style></section></section><section id="background-clip" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-clip/" data-property-name="background-clip" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-clip">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-clip" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-clip"><span>#</span>background-clip</a></h2><div class="property-description"><p>Defines how far the background should <strong>extend</strong> within the element.</p></div></header><style type="text/css">.background-clip { background: #05ffb0;border: 4px dashed;padding: 2em; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-clip: border-box;">background-clip: border-box;</code></p><div class="example-description"><p>The background extends completely throughout the element, even <strong>under</strong> the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-clip" id="background-clip-border-box">Hello world</div></div></aside><style type="text/css">#background-clip-border-box{ background-clip:border-box;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-clip: padding-box;">background-clip: padding-box;</code></p><div class="example-description"><p>The background only extends to the <em>edge</em> of the border: it includes the padding but <em>not</em> the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-clip" id="background-clip-padding-box">Hello world</div></div></aside><style type="text/css">#background-clip-padding-box{ background-clip:padding-box;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-clip: content-box;">background-clip: content-box;</code></p><div class="example-description"><p>The background only extends to the edge of the <em>content</em>: it doesn't include the padding, nor the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-clip" id="background-clip-content-box">Hello world</div></div></aside><style type="text/css">#background-clip-content-box{ background-clip:content-box;}</style></section></section><section id="background-color" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-color/" data-property-name="background-color" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-color">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-color" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-color"><span>#</span>background-color</a></h2><div class="property-description"><p>Defines the color of the element's background.</p></div></header><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: transparent;">background-color: transparent;</code></p><div class="example-description"><p>By default, the background color is <strong>transparent</strong>, basically meaning that there is <strong>no</strong> background color.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-transparent">Hello World</div></div></aside><style type="text/css">#background-color-transparent{ background-color:transparent;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: red;">background-color: red;</code></p><div class="example-description"><p>You can use one of the <strong><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">140+ color names</a></strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-red">Hello World</div></div></aside><style type="text/css">#background-color-red{ background-color:red;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: #05ffb0;">background-color: #05ffb0;</code></p><div class="example-description"><p>You can use <strong>hexadecimal</strong> color codes.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-05ffb0">Hello World</div></div></aside><style type="text/css">#background-color-05ffb0{ background-color:#05ffb0;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: rgb(50, 115, 220);">background-color: rgb(50, 115, 220);</code></p><div class="example-description"><p>You can use <strong>rgb()</strong> color codes:</p><ul><li>the first value is for <code>red</code></li><li>the second value is for <code>green</code></li><li>the third value is for <code>blue</code></li></ul><p>Each of them can have a value between <strong>0</strong> and <strong>255</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-rgb50-115-220">Hello World</div></div></aside><style type="text/css">#background-color-rgb50-115-220{ background-color:rgb(50, 115, 220);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: rgba(50, 115, 220, 0.3);">background-color: rgba(50, 115, 220, 0.3);</code></p><div class="example-description"><p>You can use <strong>rgba()</strong> color codes:</p><ul><li>the first 3 values are for <code>rgb</code></li><li>the 4th value is for the <code>alpha</code> channel and defines the opacity of the color</li></ul><p>The alpha value can go from zero <strong>0</strong> (transparent) to one <strong>1</strong> (opaque).</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-rgba50-115-220-03">Hello World</div></div></aside><style type="text/css">#background-color-rgba50-115-220-03{ background-color:rgba(50, 115, 220, 0.3);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: hsl(14, 100%, 53%);">background-color: hsl(14, 100%, 53%);</code></p><div class="example-description"><p>You can use <strong>hsl()</strong> color codes:</p><ul><li>the first value is for <code>hue</code> and can go from <strong>0</strong> to <strong>359</strong></li><li>the second value is for <code>saturation</code> and go from <strong>0%</strong> to <strong>100%</strong></li><li>the third value is for <code>luminosity</code> and go from <strong>0%</strong> to <strong>100%</strong></li></ul></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-hsl14-100-53">Hello World</div></div></aside><style type="text/css">#background-color-hsl14-100-53{ background-color:hsl(14, 100%, 53%);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-color: hsla(14, 100%, 53%, 0.6);">background-color: hsla(14, 100%, 53%, 0.6);</code></p><div class="example-description"><p>You can use <strong>hsl()a</strong> color codes:</p><ul><li>the first 3 values are for <code>hsl</code></li><li>the 4th value is for the <code>alpha</code> channel and defines the opacity of the color</li></ul><p>The alpha value can go from zero <strong>0</strong> (transparent) to one <strong>1</strong> (opaque).</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-color" id="background-color-hsla14-100-53-06">Hello World</div></div></aside><style type="text/css">#background-color-hsla14-100-53-06{ background-color:hsla(14, 100%, 53%, 0.6);}</style></section></section><section id="background-image" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-image/" data-property-name="background-image" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-image">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-image" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-image"><span>#</span>background-image</a></h2><div class="property-description"><p>Defines an image as the background of the element.</p></div></header><style type="text/css">.background-image { background-repeat: no-repeat;height: 200px; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: none;">background-image: none;</code></p><div class="example-description"><p>Removes any background image.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-none">Hello world</div></div></aside><style type="text/css">#background-image-none{ background-image:none;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: url(/images/jt.png);">background-image: url(/images/jt.png);</code></p><div class="example-description"><p>Uses the image defined in the <strong>url</strong> path. This path can either be <em>relative</em> (to the css file) or <em>absolute</em> (like <code>http://cssreference.io/images/jt.png</code>).</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-urlimagesjtpng">Hello world</div></div></aside><style type="text/css">#background-image-urlimagesjtpng{ background-image:url(/images/jt.png);}</style><style type="text/css">#background-image-urlimagesjtpng{ background-size: 64px 64px; }</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: linear-gradient(red, blue);">background-image: linear-gradient(red, blue);</code></p><div class="example-description"><p>You can define a <strong>linear gradient</strong> as the background image.</p><p>You need to define at least <strong>two colors</strong>. The first one will start at the top, the second one at the bottom.</p><p>The default angle is <code>to bottom</code> (or <code>180deg</code>), which means the gradient is <strong>vertical</strong>, starting at the top, ending at the bottom of the element.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-linear-gradientred-blue">Hello world</div></div></aside><style type="text/css">#background-image-linear-gradientred-blue{ background-image:linear-gradient(red, blue);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: linear-gradient(45deg, red, blue);">background-image: linear-gradient(45deg, red, blue);</code></p><div class="example-description"><p>You can specify an <strong>angle</strong>, either in <strong>degrees</strong>, or with keywords.</p><p>When using degress, you specify the <em>direction</em> of the gradient, or when it ends. So <code>0deg</code> means the the <strong>top</strong> of the element, like 12:00 on a clock.</p><p>In this example, <code>45deg</code> means 2:30, or the top right corner.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-linear-gradient45deg-red-blue">Hello world</div></div></aside><style type="text/css">#background-image-linear-gradient45deg-red-blue{ background-image:linear-gradient(45deg, red, blue);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: radial-gradient(green, purple);">background-image: radial-gradient(green, purple);</code></p><div class="example-description"><p>You can define a <strong>radial gradient</strong> as the background image.</p><p>You need to define at least <strong>two colors</strong>. The first one will be at the center, the second one at the edges.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-radial-gradientgreen-purple">Hello world</div></div></aside><style type="text/css">#background-image-radial-gradientgreen-purple{ background-image:radial-gradient(green, purple);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: radial-gradient(circle, green, purple);">background-image: radial-gradient(circle, green, purple);</code></p><div class="example-description"><p>You can specify the <strong>shape</strong> of the radial gradient: <strong>circle</strong> or <strong>ellipse</strong> (default).</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-radial-gradientcircle-green-purple">Hello world</div></div></aside><style type="text/css">#background-image-radial-gradientcircle-green-purple{ background-image:radial-gradient(circle, green, purple);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: radial-gradient(circle, green 0%, purple 20%, orange 100%);">background-image: radial-gradient(circle, green 0%, purple 20%, orange 100%);</code></p><div class="example-description"><p>You can specify <strong>color stops</strong> using percentage values.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-radial-gradientcircle-green-0-purple-20-orange-100">Hello world</div></div></aside><style type="text/css">#background-image-radial-gradientcircle-green-0-purple-20-orange-100{ background-image:radial-gradient(circle, green 0%, purple 20%, orange 100%);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: radial-gradient(circle closest-side, green 0%, purple 20%, orange 100%);">background-image: radial-gradient(circle closest-side, green 0%, purple 20%, orange 100%);</code></p><div class="example-description"><p>You can specify <em>where</em> the gradient should <strong>end</strong>:</p><ul><li><code>closest-side</code></li><li><code>closest-corner</code></li><li><code>farthest-side</code></li><li><code>farthest-corner</code></li></ul></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-radial-gradientcircle-closest-side-green-0-purple-20-orange-100">Hello world</div></div></aside><style type="text/css">#background-image-radial-gradientcircle-closest-side-green-0-purple-20-orange-100{ background-image:radial-gradient(circle closest-side, green 0%, purple 20%, orange 100%);}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-image: radial-gradient(circle closest-side at 45px 45px, green 0%, purple 20%, orange 100%);">background-image: radial-gradient(circle closest-side at 45px 45px, green 0%, purple 20%, orange 100%);</code></p><div class="example-description"><p>Like with the <a href="http://cssreference.io/#background-position"><code>background-position</code></a>, you can specify the <strong>position</strong> of the gradient.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-image" id="background-image-radial-gradientcircle-closest-side-at-45px-45px-green-0-purple-20-orange-100">Hello world</div></div></aside><style type="text/css">#background-image-radial-gradientcircle-closest-side-at-45px-45px-green-0-purple-20-orange-100{ background-image:radial-gradient(circle closest-side at 45px 45px, green 0%, purple 20%, orange 100%);}</style></section></section><section id="background-origin" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-origin/" data-property-name="background-origin" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-origin">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-origin" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-origin"><span>#</span>background-origin</a></h2><div class="property-description"><p>Defines the origin of the background image.</p></div></header><style type="text/css">.background-origin { background-image: url(/images/jt.png);background-repeat: no-repeat;background-size: 64px 64px;border: 4px dashed;padding: 2em; }</style><style type="text/css">.background-origin p { background-color: rgba(5, 255, 176, 0.5);padding: 1em; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-origin: padding-box;">background-origin: padding-box;</code></p><div class="example-description"><p>The background image starts at the <em>edge</em> of the border: within padding but <em>not</em> the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-origin" id="background-origin-padding-box"><p>Hello world</p></div></div></aside><style type="text/css">#background-origin-padding-box{ background-origin:padding-box;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-origin: border-box;">background-origin: border-box;</code></p><div class="example-description"><p>The background image starts <strong>under</strong> the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-origin" id="background-origin-border-box"><p>Hello world</p></div></div></aside><style type="text/css">#background-origin-border-box{ background-origin:border-box;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-origin: content-box;">background-origin: content-box;</code></p><div class="example-description"><p>The background image only starts at the edge of the <em>content</em>: it doesn't include the padding, nor the border.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-origin" id="background-origin-content-box"><p>Hello world</p></div></div></aside><style type="text/css">#background-origin-content-box{ background-origin:content-box;}</style></section></section><section id="background-position" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-position/" data-property-name="background-position" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-position">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-position" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-position"><span>#</span>background-position</a></h2><div class="property-description"><p>Defines the position of the background image.</p></div></header><style type="text/css">.background-position { background-image: url(/images/jt.png);background-repeat: no-repeat;background-size: 64px 64px;height: 150px; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-position: 0% 0%;">background-position: 0% 0%;</code></p><div class="example-description"><p>The background image will be positioned at <strong>0%</strong> on the horizontal axis and <strong>0%</strong> on the vertical axis, which means the top left corner of the element.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-position" id="background-position-0-0">Hello world</div></div></aside><style type="text/css">#background-position-0-0{ background-position:0% 0%;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-position: bottom right;">background-position: bottom right;</code></p><div class="example-description"><p>You can use a combination of <strong>position keywords</strong>: <code>center</code>, <code>top</code>, <code>bottom</code>, <code>left</code> and <code>right</code>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-position" id="background-position-bottom-right">Hello world</div></div></aside><style type="text/css">#background-position-bottom-right{ background-position:bottom right;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-position: center center;">background-position: center center;</code></p><div class="example-description"><p>The background image will be positioned in the center of the element.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-position" id="background-position-center-center">Hello world</div></div></aside><style type="text/css">#background-position-center-center{ background-position:center center;}</style></section></section><section id="background-repeat" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-repeat/" data-property-name="background-repeat" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-repeat">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-repeat" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-repeat"><span>#</span>background-repeat</a></h2><div class="property-description"><p>Defines how the background image repeats itself across the element's background, starting from the background position.</p></div></header><style type="text/css">.background-repeat { background-image: url(/images/jt.png);background-size: 64px 64px;height: 150px; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-repeat: repeat;">background-repeat: repeat;</code></p><div class="example-description"><p>The background image will repeat itself both <strong>horizontally</strong> and <strong>vertically</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-repeat" id="background-repeat-repeat">Hello world</div></div></aside><style type="text/css">#background-repeat-repeat{ background-repeat:repeat;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-repeat: repeat-x;">background-repeat: repeat-x;</code></p><div class="example-description"><p>The background image will only repeat itself <strong>horizontally</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-repeat" id="background-repeat-repeat-x">Hello world</div></div></aside><style type="text/css">#background-repeat-repeat-x{ background-repeat:repeat-x;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-repeat: repeat-y;">background-repeat: repeat-y;</code></p><div class="example-description"><p>The background image will only repeat itself <strong>vertically</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-repeat" id="background-repeat-repeat-y">Hello world</div></div></aside><style type="text/css">#background-repeat-repeat-y{ background-repeat:repeat-y;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-repeat: no-repeat;">background-repeat: no-repeat;</code></p><div class="example-description"><p>The background image will only appear <strong>once</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-repeat" id="background-repeat-no-repeat">Hello world</div></div></aside><style type="text/css">#background-repeat-no-repeat{ background-repeat:no-repeat;}</style></section></section><section id="background-size" class="property"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background-size/" data-property-name="background-size" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background-size">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background-size" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background-size"><span>#</span>background-size</a></h2><div class="property-description"><p>Defines the size of the background image.</p></div></header><style type="text/css">.background-size { background-image: url(/images/landscape.jpg);background-repeat: no-repeat;height: 150px;padding: 0; }</style><section class="example"><header class="example-header"><p class="example-name"><code class="example-default" data-tooltip="This is the property's default value">default</code> <code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-size: auto auto;">background-size: auto auto;</code></p><div class="example-description"><p>The background image will retain its <strong>original</strong> size.</p><p>For example, this background image is <strong>960px by 640px</strong> large. Its aspect ratio is <strong>3 by 2</strong>. It's bigger than its container (which is 150px high) and will thus be <strong>clipped</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-size" id="background-size-auto-auto">Hello world</div></div></aside><style type="text/css">#background-size-auto-auto{ background-size:auto auto;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-size: 120px 80px;">background-size: 120px 80px;</code></p><div class="example-description"><p>You can specify a size in <strong>pixels</strong>:</p><ul><li>the first value is the <strong>horizontal</strong> size</li><li>the second is the <strong>vertical</strong> size</li></ul></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-size" id="background-size-120px-80px">Hello world</div></div></aside><style type="text/css">#background-size-120px-80px{ background-size:120px 80px;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-size: 100% 50%;">background-size: 100% 50%;</code></p><div class="example-description"><p>You can use <strong>percentage</strong> values as well. Beware that this can alter the <strong>aspect ratio</strong> of the background image, and lead to unexpected results.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-size" id="background-size-100-50">Hello world</div></div></aside><style type="text/css">#background-size-100-50{ background-size:100% 50%;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-size: contain;">background-size: contain;</code></p><div class="example-description"><p>The keyword <code>contain</code> will resize the background image to make sure it remains <strong>fully visible</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-size" id="background-size-contain">Hello world</div></div></aside><style type="text/css">#background-size-contain{ background-size:contain;}</style></section><section class="example"><header class="example-header"><p class="example-name"><code class="example-value" data-tooltip="Click to copy" data-clipboard-text="background-size: cover;">background-size: cover;</code></p><div class="example-description"><p>The keyword <code>cover</code> will resize the background image to make sure the element is <strong>fully covered</strong>.</p></div></header><aside class="example-preview"><div class="example-browser"><i></i><i></i><i></i></div><div class="example-output"><div class="example-output-div background-size" id="background-size-cover">Hello world</div></div></aside><style type="text/css">#background-size-cover{ background-size:cover;}</style></section></section><section id="background" class="property property--shorthand"><header class="property-header"><nav class="property-links"><a class="property-collection" href="{{site.url}}/backgrounds/">In collection: <strong>backgrounds</strong> </a><a class="property-links-direct" href="{{site.url}}/property/background/" data-property-name="background" data-tooltip="Single page for this property">Permalink</a> <a class="property-share" data-tooltip="Share on Twitter or Facebook" data-property-name="background">Share</a> <a target="_blank" href="https://developer.mozilla.org/en/docs/Web/CSS/background" data-tooltip="See on Mozilla Developer Network" rel="external">MDN</a></nav><h2 class="property-name"><a href="#background"><span>#</span>background</a></h2><div class="property-description"><p>Shorthand property for <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-image" data-property-name="background-image">background-image</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-position" data-property-name="background-position">background-position</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-size" data-property-name="background-size">background-size</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-repeat" data-property-name="background-repeat">background-repeat</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-origin" data-property-name="background-origin">background-origin</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-clip" data-property-name="background-clip">background-clip</a></code> <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-attachment" data-property-name="background-attachment">background-attachment</a></code> and <code class="shorthand"><a class="hash" href="{{site.url}}/property/background-color" data-property-name="background-color">background-color</a></code>.</p></div></header></section>