When targeting a single div, it's important to adjust your selector accordingly. It seems like you want to apply the animation to all images within just one div, not all images on the page.
Here is how your code should be modified:
img {
animation: blink 1s;
animation-iteration-count: infinite;
}
You can update it to target a specific div like this:
div#specificDiv img {
animation: blink 1s;
animation-iteration-count: infinite;
}
Alternatively, you can use a class selector like this:
div.imageContainer img {
animation: blink 1s;
animation-iteration-count: infinite;
}
This way, the styles will only be applied to images inside the div#specificDiv
or within any div with the class imageContainer
.
Using "#" in the selector (div#specificDiv
) targets a div by its id attribute, while "." (div.imageContainer
) targets elements by their class. Using classes is preferred for flexibility, even if there's only one element with that style initially, as it allows for easier reuse of the styling in the future.