Would it be possible to use CSS in this case?


#1

Would there be a way I could use the img tag and make some magic so I can assign a certain link to each image using CSS?

Something like:

img {link: "test.com";}

Going through nine links isn't that hard but sure is quite boring.

Lesson: here!

Edit: noticed such tags won't show up when quoted so I'm supposed to wrap my img tags with a tags.


#2

To assign content with CSS, use the pseudo elements, :before and :after. It will look something like:

img:before {
    content: '<a href="https://www.codecademy.com">';
}
img:after {
    content: '</a>';

}


#3

Thanks, @mtf! :sunny:


#4

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