<div>
我在 SASS中绘制了一个网格作为以下方式的重复背景:
background-image:
repeating-linear-gradient(0deg, $major-grid-color, $major-grid-color $major-grid-weight, transparent $major-grid-weight, transparent $major-grid-size),
repeating-linear-gradient(-90deg, $major-grid-color, $major-grid-color $major-grid-weight, transparent $major-grid-weight, transparent $major-grid-size),
repeating-linear-gradient(0deg, $minor-grid-color, $minor-grid-color $minor-grid-weight, transparent $minor-grid-weight, transparent $minor-grid-size),
repeating-linear-gradient(-90deg, $minor-grid-color, $minor-grid-color $minor-grid-weight, transparent $minor-grid-weight, transparent $minor-grid-size);
它呈现以下方式:
但我希望它以15px
向左偏移(或4 * $minor-grid-size + 15px
向右偏移)呈现,即:
现在我不能使用margin-left
,因为它也会偏移<div>
标签内的元素,我不希望这样,看这里的小提琴(不要关注 JS)。
我只希望背景有一个偏移量。