This page requires either a Gecko-based browser whose rendering code is no
older than the last day or so of July 2009 (based off trunk code at that time
in mozilla-central) or a browser with support for the unprefixed
CSS 3 background properties. Other
browsers are not supported either because I don't know they exist or because
their background-size
support, prefixed or otherwise, doesn't
match the latest spec, and I'd rather avoid possible confusion.
height: 5em; background-color: white; background-repeat: no-repeat; background-size: 50%; -moz-background-size: 50%; background-image: url(cowbell.jpg); border: 1px solid black;
background-position
to effect this (moving it from behind
this text for legibility). Note that the position is calculated with respect
to the resized image dimensions, not with respect to its intrinsic
size.
height: 5em; background-color: white; background-repeat: no-repeat; background-size: 50% 50%; -moz-background-size: 50% 50%; background-image: url(cowbell.jpg); border: 1px solid black; background-position: 100% 100%;
height: 6em; font-size: 1.5em; background-color: white; background-repeat: repeat; background-size: auto 50%; -moz-background-size: auto 50%; background-image: url(cowbell.jpg); border: 1px solid black;
height: 5em; background-color: white; background-repeat: repeat; background-size: auto 75px; -moz-background-size: auto 75px; background-image: url(cowbell.jpg); border: 1px solid black;
height: 5em; background-color: white; background-repeat: repeat; background-size: 150px 75px; -moz-background-size: 150px 75px; background-image: url(cowbell.jpg); border: 1px solid black;
height: 5em; background-color: white; background-repeat: no-repeat; background-size: 100% 100%; -moz-background-size: 100% 100%; background-image: url(cowbell.jpg); border: 2em dashed pink;
height: 5em; background-color: white; background-repeat: no-repeat; background-size: 100% 100%; -moz-background-size: 100% 100%; background-image: url(cowbell.jpg); border: 2em dashed pink; -moz-background-origin: border; background-origin: border-box;
The image used throughout this demo is this image, displayed at original size, from the Wikimedia Commons; see COPYING for usage details:
Feel free to take a look at the rest of my site while you're here.