I want to do this using only the one background property.
But the chessboard background is not 64 x 64 and has 384 x 256 size
Chessboard MUST_BE 64 x 64
This is my attempt:
<!DOCTYPE html><style>
body { margin:0; background-color:#000 }
div {
width: 768px;
height: 512px;
background: conic-gradient(from 90deg at 1px 1px,#0000 90deg,#5a5 0) 384px 256px,
repeating-conic-gradient(#a55 0% 25%, #105 25% 50%) 64px 64px
}
</style><div></div>
2
Answers
You are setting the position, not the size. The correct syntax is
position / size
wheresize
is optional.And you can use
50% 50%
for the size of the first gradient, no need to do the calculation manuallyyou can fix it using
To set different sizes for multiple backgrounds, you can use the background-size property in CSS. This property specifies the size of the background images.
In this configuration, the background-size property is set to 384px 256px, 64px 64px. This means the first background image (the conic gradient) will be 384px wide and 256px high, and the second background image (the repeating conic gradient) will be 64px wide and 64px high. The sizes are specified in the same order as the images in the background property.
Thanks…