Change href value in @keyframe

So i want to make a div element which has 4 images with anchors in it side by side from left to right. I need the images to change so i thought of using @keyframe to change the images but i also need the anchor to change along with the image. Is there a way to change the href using css? Im new at this and only know some html and css . Any other better ways of doing this that I’m not aware of?

Nope. You can’t change attributes with CSS. CSS is just for styling.

Any other way I could make the auto-slider that would allow me to modify the ref link along with the photo?

I’m not sure what you’re trying to do, but with just HTML and CSS what you can do is have multiple elements that you show/hide that have different attributes. To actually change attributes, you’d want to use JavaScript.

You could put all four images inside a container side by side and

  • limit the width of the container to the width of one image (assuming they’re all the same width)
  • set the container to overflow:hidden and position:relative
  • set the images to position:absolute and top:0
  • use keyframes to animate the left property of each image

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.