CSS background 图片重复示例

CSS background1 个文件更新于 2026-04-06
html公开前 25 行,完整代码需登录
<!DOCTYPE html>
<html>
  <head>
    <style>
      .repeat-box {
        width: 100%;
        height: 300px;
        border: 1px solid #aaa;
        margin-bottom: 5px;
        background-color: #f5f7fa;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: #222;
        font-weight: bold;
      }
      .repeat-x {
        background-image: url("/fs/uploads/tutorial/2026/01/727efe41495e61ee53b4d30a5ded4e1a.png");
        background-repeat: repeat-x;
      }
      .repeat-y {
        background-image: url("/fs/uploads/tutorial/2026/01/727efe41495e61ee53b4d30a5ded4e1a.png");
        background-repeat: repeat-y;
      }

登录后可以查看完整源码、在线编辑并实时预览运行效果。