HTML How to Make a Website Adding Pages to a Website Add Iconography

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Why did the background image migrated on the left side of the anchor?

Is this the default behavior for a background image, to migrate on the left side of an element when we set its value to no-repeat? I don't understand why the image and the anchor element act like 2 distinct elements when adding padding - they move away from each other. Thank you.

1 Answer

Chris Wiley
Chris Wiley
14,669 Points

The background images start at the top left and repeat to the right. So when they set the background-repeat to no-repeat it only shows the image once and that will be to the top and left of the anchor. The padding on the left side of the anchor pushes the anchor text to the right. The background image just stays where it is and it looks like there is a separation of the image and the anchor. The background isn't affected by padding.