Skip to content

I want to create a simple and responsive gallery for my portfolio. Can someone point me in the right direction?

So I'm recreating my portfolio website, something I've been meaning to do for a while. I am going to keep it simple this time around using only html/css instead of WordPress.

I'm focusing only on my artwork and a brief background, so the main thing I want people to see is a gallery of images. When you click on them I don't want another window to open similar to lightbox, I just want them to get larger on the page itself.

Could anyone point me in the direction of something to use? I've been searching google for "responsive portfolio gallery" and am kind of lost.

Thank you!

2 points3 comments
Open on Reddit
About this post
Posted
Archived
Score
2 · 100% up
Kind
Text
ID
447497

Author

10
posts
15
comments
2
media
View profile

3 comments

If you use a fluid grid system for the portfolio and have each thumbnail open to a larger view in a lightbox, that would work.

Even an inline (horizontal) list that wraps would work, like this:

<ul class="portfolio">  
<li>[thumb1]</li>  
<li>[thumb2]</li>
<li>[thumb3]</li>
<li>[thumb4]</li>  
<li>[thumb5]</li>  
<li>[thumb6]</li>
...etc...  
</ul>  

In your CSS, you would style it something like this:

.portfolio { margin-left:0 ;  
padding-left:0 ;  
list-style-type:none ;  
}  
  
.portfolio li { display:inline-block ;  
-webkit-box-sizing: border-box;  
-moz-box-sizing: border-box;  
box-sizing: border-box;  
margin-right:-4px /* this gets rid of the funky space that inline-block can sometimes force */  
padding:12px ;  
width:25% /* this gives you a 4-across grid on desktop */
}  
  
.portfolio li img { display:block }

And then in your media queries you can set new widths for the <li>:

For tablet in portrait view (landscape should still be able to use desktop <li> widths):

@media only screen and (max-width: 768px) {
.portfolio li { width:33.3333% /* gives a 3-across grid */ ;  
}  
}  

And for smartphones (landscape):

@media only screen and (max-width: 480px) {
.portfolio li { width:50% /* gives a 2-across grid */ ;  
}  
} 

And for smartphones (portrait):

@media only screen and (max-width: 320px) {
.portfolio li { width:100% /* gives a single column grid */ ;  
}  
} 

Hope that helps!

4 points
unknown author

Deleted before we saved it.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.