View Categories

CSS Image Gallery

3 min read

Агуулга

CSS can be used to create an image gallery.

Image Gallery #

The following image gallery is created with CSS:

<!DOCTYPE html> <html> <head> <style> div.gallery { margin: 5px; border: 1px solid #ccc; float: left; width: 180px; } div.gallery:hover { border: 1px solid #777; } div.gallery img { width: 100%; height: auto; } div.desc { padding: 15px; text-align: center; } </style> </head> <body> <div class="gallery"> <a target="_blank" href="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/39.jpg"> <img src="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/39.jpg" alt="Talbai" width="500" height="300"> </a> <div class="desc">Add a description of the image here</div> </div> <div class="gallery"> <a target="_blank" href="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/41.jpg"> <img src="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/41.jpg" alt="Forest" width="500" height="300"> </a> <div class="desc">Add a description of the image here</div> </div> <div class="gallery"> <a target="_blank" href="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/43.jpg"> <img src="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/43.jpg" alt="Northern Lights" width="500" height="300"> </a> <div class="desc">Add a description of the image here</div> </div> <div class="gallery"> <a target="_blank" href="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/42.jpg"> <img src="https://mgl-bucket.s3.eu-central-1.amazonaws.com/mgl/42.jpg" alt="Mountains" width="500" height="300"> </a> <div class="desc">Add a description of the image here</div> </div> </body> </html>

Powered by BetterDocs

Leave a Reply