
- CSS Tutorial
- CSS - Home
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Measurement Units
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursors
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS Advanced
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Media Types
- CSS - Paged Media
- CSS - Aural Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS3 Tutorial
- CSS3 - Tutorial
- CSS3 - Rounded Corner
- CSS3 - Border Images
- CSS3 - Multi Background
- CSS3 - Color
- CSS3 - Gradients
- CSS3 - Shadow
- CSS3 - Text
- CSS3 - Web font
- CSS3 - 2d transform
- CSS3 - 3d transform
- CSS3 - Animation
- CSS3 - Multi columns
- CSS3 - User Interface
- CSS3 - Box Sizing
- CSS Responsive
- CSS - Responsive Web Design
- CSS References
- CSS - Questions and Answers
- CSS - Quick Guide
- CSS - References
- CSS - Color References
- CSS - Web browser References
- CSS - Web safe fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
How to create an image gallery with CSS
To create an image gallery with CSS is quite easy. You can try to run the following code to achieve this. A gallery of 3 images is created here,
Example
<!DOCTYPE html> <html> <head> <style> div.myGallery { margin: 3px; border: 2px solid orange; float: left; width: 220px; } div.myGallery:hover { border: 1px solid blue; } div.myGallery img { width: 100%; height: auto; } div.desc { padding: 20px; text-align: center; } </style> </head> <body> <div class = "myGallery"> <a target = "_blank" href="https://www.tutorialspoint.com/assets/videotutorials/courses/3d_animation_online_training/380_course_211_image.jpg"> <img src = "https://www.tutorialspoint.com/assets/videotutorials/courses/3d_animation_online_training/380_course_211_image.jpg" alt="3D Animation Tutorial" width="600" height="500"> </a> <div class = "mydiv">3D Animation Tutorial</div> </div> <div class = "myGallery"> <a target="_blank" href="https://www.tutorialspoint.com/assets/videotutorials/courses/swift_4_online_training/380_course_210_image.jpg"> <img src = "https://www.tutorialspoint.com/assets/videotutorials/courses/swift_4_online_training/380_course_210_image.jpg" alt="Swift Video Tutorial" width="600" height="500"> </a> <div class = "mydiv">Swift Video Tutorial</div> </div> <div class = "myGallery"> <a target = "_blank" href = "https://www.tutorialspoint.com/assets/videotutorials/courses/css_online_training/380_course_215_image.jpg"> <img src = "https://www.tutorialspoint.com/assets/videotutorials/courses/css_online_training/380_course_215_image.jpg" alt="CSS Video Tutorial" width="600" height="500"> </a> <div class = "mydiv">CSS Tutorial</div> </div> </body> </html>
- Related Articles
- How to create a responsive image gallery with CSS
- How to create a modal image gallery with CSS and JavaScript?
- How to create a tabbed image gallery with CSS and JavaScript?
- How to Create Image Lightbox Gallery using HTML CSS and JavaScript?
- How to Create a Tab Image Gallery?
- How to create a responsive portfolio gallery grid with CSS?
- How to create an avatar image with CSS?
- How to create a responsive slideshow gallery with CSS and JavaScript?
- How to pick an image from image gallery in Android?
- How to create an image to zoom with CSS and JavaScript?
- How to create image filters with CSS
- How to create Portfolio Gallery using the HTML and CSS
- How to create an image overlay title on hover with CSS?
- How to pick an image from an image gallery on Android using Kotlin?
- How to create a Hero Image with CSS?

Advertisements