CSS background-origin 示例
html公开前 25 行,完整代码需登录
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>CSS background-origin 示例</title>
<style>
.demo-box {
width: 400px;
margin: 0 auto;
font-size: 20px;
font-family: sans-serif;
}
.origin-demo-box {
width: 100%;
height: 200px;
border: 20px dotted #666;
padding: 18px;
background-image: url("/fs/uploads/tutorial/2026/01/d29e6e3e6d2bed5d107a5a9bb04fa68d.jpg");
background-repeat: no-repeat;
background-size: cover;
background-color: #2196F3;
box-sizing: border-box;
margin-bottom: 24px;
position: relative;
display: flex;