Interactive online courses HTML Academy
2026-03-09 14:05 Diff

Sometimes gradients whose directions are specified using degrees and diagonals look the same.

to right top45deg

However, these behaviors work differently. Gradients that are specified using degrees are assigned independently of the shape of the container, whereas diagonal gradients are dependent on the latter. Diagonal gradients always remain anchored to their corners.

Of course, if the containers are square, then there will be no difference. But what happens if you stretch them in height? Let’s check.