03. Background Placement background-clip, background-origin

You can specify where in your container you want the background to be placed in. There are two CSS properties you can use:background-clip andbackground-origin.

Background Clip

The background-clip property tells where the containing element should start clipping the background. By default, it is set to border-box.

background-clip: border-box

background-clip: padding-box

background-clip: content-box

The image still starts at the top right corner.

The red color indicates portions that are cut off. Thus the border-box won't cut any of the image, while the padding-box and content-box does.

Background Origin

The background-origin tells where a background's top right corner should be placed.

This is very similar to background-clip in its option for values.

Thus, by having the same value for this property as background-clip, we can avoid an image from being cropped.

Build modern and responsive webpages

Responsive Typography

Build modern and responsive webpages Try Front-end

Responsive web design helps your site maintain its design integrity on a variety of screen sizes, but how does it affect your typography? With this practical book, graphic designers, web designers, and front-end developers alike will learn the nuts and bolts of how to get the best appearance from type without sacrificing performance on any device.

$ Check price
24.9924.99Amazon 4.5 logo(3+ reviews)

More Front-end resources

Aching back from coding all day?

Acupressure Mat & Pillow

Aching back from coding all day? Try Back Problems

Relieve your stress, back, neck and sciatic pain through 1,782 acupuncture points for immediate neck pain relief. Made for lower, upper and mid chronic back pain treatment, and improves circulation, sleep, digestion and quality of life.

$$ Check price
144.87144.87Amazon 4.5 logo(1,890+ reviews)

More Back Problems resources