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?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Ad