


How to distinguish background-clip and background-origin in css3? (code example)
This chapter will introduce to you how to distinguish background-clip and background-origin in CSS3? (code example). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
In CSS3, background-clip and background-origin have roughly the same functions, but there are some subtle differences.
1. Background-clip attribute
background-clip: Specifies the drawing area of the background. When the background is a pure color and a picture, its display method is different. Same. It has 3 attributes: border-box, padding-box, content-box.
1. border-box: The background is drawn from the border, but when the background is a picture, it is drawn on the left and top There is no picture drawn, but there is one below and on the right;
Code:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> div { width:433px; height:200px; padding:50px; background-color: red; background-image:url('8.jpg'); background-repeat:no-repeat; -webkit-background-clip:border-box; border:10px dashed #92b901; } </style> </head> <body> <div> 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 </div> </body> </html>
Rendering:
2. Background-origin attribute
background-origin: Specifies the positioning area of the background image. Its attributes also include border-box, padding-box, and content-box. However, please note that its description is "background image", that is It is said that it can only perform style operations on the background. It is equivalent to positon, which stipulates the area where the picture starts to be drawn. In other words, it is only equivalent to stipulating where the upper left corner of the picture starts, and it is not responsible for the rest;<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <style> div { width: 500px; height: 300px; /*padding: 50px;*/ background-color: red; background-image: url('8.jpg'); background-repeat: no-repeat; -webkit-background-origin: content-box; background-size: 500px 380px; border: 10px dashed #92b901; } </style> </head> <body> <div> 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。这是文本。 </div> </body> </html>Rendering:
The above is the detailed content of How to distinguish background-clip and background-origin in css3? (code example). For more information, please follow other related articles on the PHP Chinese website!

GooFonts is a side project signed by a developer-wife and a designer-husband, both of them big fans of typography. We’ve been tagging Google

Pavithra Kodmad asked people for recommendations on what they thought were some of the most timeless articles about web development that have changed their

Learning how to build GraphQL APIs can be quite challenging. But you can learn how to use GraphQL APIs in 10 minutes! And it so happens I've got the perfect

When a component lives in an environment where the data queries populating it live nearby, there is a pretty direct line between the visual component and the

Here's some legit CSS trickery from yuanchuan. There is this CSS property offset-path. Once upon a time, it was called motion-path and then it was renamed. I

Miriam Suzanne explains in a Mozilla Developer video on the subject.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver CS6
Visual web development tools

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version