![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Style backgroundClip Property
The backgroundClip property lets us control how far the background image will be painted i.e. the painting area of the background image. It is used for setting or returning that painting area.
Syntax
Following is the syntax for −
Setting the backgroundClip property −
background-clip: border-box | padding-box | content-box
Values
Following are the values −
Sr.No | Value & Description |
---|---|
1 | border-box This clips the background within the border-box and this is the default value. |
2 | padding-box This clips the background within the padding box. |
3 | content-box The background is clipped within the content box. |
Example
Let us look at an example for the backgroundclip property −
<!DOCTYPE html> <html> <head> <style> #one { box-shadow: 0 0 2px black; padding: 18px; background: skyblue; background-clip: content-box; } </style> <script> function changeBackClip(){ document.getElementById("one").style.backgroundClip="padding-box"; document.getElementById("Sample").innerHTML="The background clip property is now padding-box"; background-clip: border-box | padding-box | content-box } </script> </head> <body> <div id="one"> Phasellus eu justo lectus. Praesent et nulla facilisis, venenatis justo eget, tempor lectus. Integer ut felis vel lectus convallis fermentum. Fusce ut felis mauris.</div> <p>Change the above div background-clip value by clicking the below button</p> <button onclick="changeBackClip()">CHANGE CLIP</button> <p id="Sample"></p> </body> </html>
Output
This will produce the following output −
On clicking the CHANGE CLIP button −
Advertisements