Last active
October 22, 2024 07:45
-
-
Save soham2008xyz/34a2c5ba0a3ff49966b4dade2527b6fb to your computer and use it in GitHub Desktop.
WordPress default gallery styling
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* General gallery container styling */ | |
.gallery { | |
display: grid; | |
gap: 10px; | |
margin: 20px 0; | |
list-style: none; | |
padding: 0; | |
} | |
/* Columns based on gallery-classes */ | |
.gallery-columns-1 { | |
grid-template-columns: 1fr; | |
} | |
.gallery-columns-2 { | |
grid-template-columns: repeat(2, 1fr); | |
} | |
.gallery-columns-3 { | |
grid-template-columns: repeat(3, 1fr); | |
} | |
.gallery-columns-4 { | |
grid-template-columns: repeat(4, 1fr); | |
} | |
.gallery-columns-5 { | |
grid-template-columns: repeat(5, 1fr); | |
} | |
.gallery-columns-6 { | |
grid-template-columns: repeat(6, 1fr); | |
} | |
/* Gallery items */ | |
.gallery-item { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} | |
.gallery-icon { | |
width: 100%; | |
height: auto; | |
overflow: hidden; | |
} | |
/* Image styling */ | |
.gallery-icon img { | |
width: 100%; | |
height: auto; | |
object-fit: cover; | |
transition: transform 0.3s ease; | |
} | |
/* Hover effect */ | |
.gallery-icon img:hover { | |
transform: scale(1.05); | |
} | |
/* Responsive fallback for small screens */ | |
@media (max-width: 768px) { | |
.gallery-columns-2, | |
.gallery-columns-3, | |
.gallery-columns-4, | |
.gallery-columns-5, | |
.gallery-columns-6 { | |
grid-template-columns: 1fr 1fr; | |
} | |
} | |
@media (max-width: 480px) { | |
.gallery-columns-2, | |
.gallery-columns-3, | |
.gallery-columns-4, | |
.gallery-columns-5, | |
.gallery-columns-6 { | |
grid-template-columns: 1fr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment