r/HTML • u/ChiliChapters • Aug 02 '26
Question Trying to create a div that only displays when an image is clicked.
I've already set up the first image in my gallery to zoom in and dim the background when clicked. I'm trying to make it so that a link appears underneath the image when it's zoomed in, prompting the user to visit it to see the full image. I'm having difficulty getting any text to show up though. I'm wondering if it's being "overwritten" by some other element, but I thought having a higher z-index would help.
Any help would be appreciated. Thank you!
This is the specific page. The image is the first on the left in the 2026 category, the black/white/red one. Please feel free to inspect the html/css. https://chilichapters.neocities.org/pm
1
u/gucci_stylus Aug 02 '26
try selecting the parent element of the image and append a new child element, then make the new child element a link
1
u/tkgid Aug 02 '26
Idk exactly how, but I would try to incorporate a <figcaption> mixed with a bit of JS onclick sauce.
CSS default would be display none. Js will change the "display" state to absolute. I hope this idea helps.
0
u/Weekly_Ferret_meal Aug 02 '26
So MDN uses
<figcaption>like so:I guess you can add a link in the
<figcaption>like so:0
u/[deleted] Aug 02 '26
[deleted] — view deleted comment