Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ General Web Design _ Image gallery

Posted by: macugab Apr 27 2021, 07:35 PM

Hi, i have an image gallery on my HTML and CSS. It doesn't work as it is supposed to.

Thanks!


Attached File(s)
Attached File  index.html ( 1.45k ) Number of downloads: 214
Attached File  gallerie.css ( 741bytes ) Number of downloads: 217

Posted by: pandy Apr 27 2021, 07:47 PM

OK. And in what way doesn't it work as you want?

Posted by: macugab Apr 28 2021, 07:40 AM

The bigger images must pop up when you click on the smaller ones.

In the CSS, the <span> sections must be hidden, with the property "visibility-hidden"

Posted by: pandy Apr 28 2021, 09:16 AM

You've got the selectors wrong. You don't need to be this specific, but as you have it you need a space between the class names.

You have

CODE
.gallery.vignette span

and it should be like so.
CODE
.gallery. vignette span


That goes for the selector for the rule that shows the large image and for at least one more too.

What you want is a contextual AKA descendant selector. It consists of two or more singular selectors with a space between them.

CODE
div p span


The above would match any span that's inside any P that's inside any DIV.

I don't remember if what you wrote has an actual name, but it's sometimes called "chaining". It matches an element that has all listed classes. So with what you wrote the browser looks for something like this - and it isn't there.

CODE
<div class="gallery vignette">
<span>...</span>
</div>

Posted by: macugab Apr 28 2021, 05:14 PM

It works with the space betwen class names!

Thank you very much!

Posted by: pandy Apr 28 2021, 06:34 PM

Yup. I tried it. You are welcome. smile.gif

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)