您可以尝试运行以下代码来实现 content-box 值:
示例现场演示
<!doctype html><html> <head> <style> #value1 { border: 3px solid blue; padding: 30px; background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg); background-repeat: no-repeat; background-origin: padding-box; } #value2 { border: 3px solid orange; padding: 30px; background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg); background-repeat: no-repeat; background-origin: border-box; } #value3 { border: 3px dashed yellow; padding: 30px; background: url(https://www.tutorialspoint.com/assets/videotutorials/courses/html_online_training/380_course_216_image.jpg); background-repeat: no-repeat; background-origin: content-box; } </style> </head> <body> <h1>padding-box value</h1> <div id = "value1"> <h2>heading 2</h2> <p>this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. <h3>heading 3</h3> this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text.</p> </div> <h1>border-box value</h1> <div id = "value2"> <h2>heading 2</h2> <p>this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. <h3>heading 3</h3> this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text.</p> </div> <h1>content-box value</h1> <div id = "value3"> <h2>heading 2</h2> <p>this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. <h3>heading 3</h3> this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text. this is demo text.</p> </div> </body></html>
以上就是css 内容框值的详细内容。