Compass Background Size

This mixin provides cross browser access to the CSS3 background-size attribute using supported vendor prefixes. See CSS3 spec: background-size.

This file can be imported using: @import "compass/css3/background-size"

View the Source for this module on Github.

Examples

Background Size
See background-size in action.

Imports

The following sass files are automatically imported when you import this file:

  1. CSS3 Utilities

Configurable Variables help

Value
100% auto
Description

override to change the default

Mixins

View Source: Sass | SCSS

=background-size($size: $default-background-size)
  $size: unquote($size)
  +experimental(background-size, $size, -moz, -webkit, -o, not -ms, not -khtml)
@mixin background-size($size: $default-background-size) {
  $size: unquote($size);
  @include experimental(background-size, $size, -moz, -webkit, -o, not -ms, not -khtml); }

Set the size of background images using px, width and height, or percentages. Currently supported in: Opera, Gecko, Webkit.

  • percentages are relative to the background-origin (default = padding-box)
  • mixin defaults to: $default-background-size