CodeLab
Tutorials For Everyone
Run
<!Doctype HTML> <html> <head> <title>The Background origin</title> <style> .origin1 { border: 20px dotted black; padding: 20px; background: url("https://www.tutsinsider.com/wp-content/uploads/2019/08/taj-mahal.jpg"); background-repeat: no-repeat; background-origin: border-box; margin: 30px; } .origin2 { border: 20px dotted black; padding: 20px; background: url("https://www.tutsinsider.com/wp-content/uploads/2019/08/taj-mahal.jpg"); background-repeat: no-repeat; background-origin: padding-box; margin: 30px; } .origin3 { border: 20px dotted black; padding: 20px; background: url("https://www.tutsinsider.com/wp-content/uploads/2019/08/taj-mahal.jpg"); background-repeat: no-repeat; background-origin: content-box; margin: 30px; } </style> </head> <body> <h2>Background Origin Property</h2> Background Origin property will define the starting position of the background image. See the below example. <div class="origin1"> border-box: defines the background image start position from upper left corner from the outer edge of the border. </div> <div class="origin2"> padding-box: defines the background image start position from upper left corner from the inner edge of the border. </div> <div class="origin3"> content-box: defines the background image start position from upper left corner within the content. </div> </body> </html>