Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

CSS lightbox made with PHP (no JS)

UPDATE: I have solved the problem (although not entirely)...the problem was with my CSS code. I had to add the following to my stylesheet:

.gallery article:target {
    width: 100%;
    height: 100%;
    z-index: 1;
}

I am trying to create a lightbox gallery using CSS and PHP. The image is showing and I've successfully hidden the lightbox container <figure> from view.

The problem is that when the photo is clicked nothing happens; the lightbox does not show.

How can I get my lightbox to work?

<ul class="gallery">
                <li>
                    <a href="#img1">
                      <?php echo(types_render_field( "gallery-  image-1", array( "alt" => "blue bird", "width" => "140", "height" => "140", "proportional" => "true" ) )); ?>
                    </a>
                    <article id="img1"><!--<article> acts as the lightbox container-->
                        <figure>
                            <?php echo(types_render_field( "gallery-image-1", array( "alt" => "blue bird", "width" => "140", "height" => "140", "proportional" => "true" ) )); ?>
                        </figure>
                        <nav><!--<nav> adds prev and next options-->
                            <a class="close" href="#close">Close</a>
                            <a class="arrow prev" href="#img15">Previous</a>
                            <a class="arrow next" href="#img2">Next</a>
                        </nav>
                    </article>
                </li>
</ul>

Carla, Glad you caught it, I just checked in for the day!! Best to you!