I would probably add the border to the img element
.picgrid ul li img { border: solid 3px #fff ; }
This is if you only have only one row. I think you have to define the rows if you have multiple rows.
Another suggestion, for your .picgrid, rather than defining the width with margins
There are several methods. If the border is shared by the images and consistent, then applying a background-color and border-spacing to the table is the easiest. border-spacing must be declared in px, not percents nor ems.
.picgrid {
border-spacing:16px 16px; /* horiz vert */
background-color:#bdf; /* color of your choice */
}
You would need to delete the percent padding from .picgrid ul li {}
David, Do you want to click on a smaller image to show a larger image and then click again to close the larger image? Since the site seems to be designed for a desktop sized viewport, you could use hover instead of clicks. Do you want the larger image displayed in the same window as the thumb or do you want it displayed in a lightbox?
I posted an example of this in your other thread: On the hunt for a pure css slider but need some advice - #15 by Erik_J
It’s the second list, not a table but the view-image code is the same. The images can’t get focus on their own, but wrap them in an anchor tag that can recieve focus:
Come to think of: The anchor’s empty fragment identifier targets the page itself and can cause a jump depending on scroll position.
Avoid the eventual jump by switch to/add an id-name to the image container and let the anchors target that id.
Example:
Should have made the effort and test the example code in your Codepen before posting.
If the image pops up under the mouse when the button is released it will loose focus and not stay up. The easy fix is to move the popup to not position under the mouse.
Ok, example tested in your Codepen:
/* Sitepoint gride layour help */
.picgrid {
display: table;
border-spacing: 16px 16px;
background-color: #bdf;
margin-left: auto;
margin-right: auto;
max-width: 800px;
}
.picgrid ul {
display: table-row;
}
.picgrid ul li {
position:relative; <-- moved from parent container
display: table-cell;
padding: 0%;
}
.picgrid ul li img{
border:0;
width:150px;
height:auto;
}
.picgrid ul li a:focus img{
position:absolute;
z-index:1;
right:-300px;
bottom:90%; /* relative the thumb's bottom */
left:-300px;
margin:auto; /* on AP, it centers between the given positions - adjust center with differing values */
width:auto;
height:auto;
max-width:750px; /* widest image that will centre within the values above */
}
I do love the light box effect but i want to avoid any jquery because if anything goes wrong with the jquery i am totally clueless whereas with HTML and CSS i am at best 50% clueless!
I’m not too good with anything js related, but that lightbox script is easy to use, the work is done for you already. You just copy the scripts, a css file and a few images to your site, then link to them on your page. The only thing you may need to edit in the script are the file paths to the images (close, next, prev icons), which is not difficult.
Adding the picture links to the page is just done by html anchors.
Well I’ve made a tonne of progress thanks to a skip load of help from Sitepoint members. Now I would like to learn how to make the on hover images reponsive so they can fit a mobile.
The first two bride pics on the grid have the on hover effect I was after thanks to Erik. Now I wonder is there a way to make the larger on hover image fit better for mobile?
A good tutorial source would be good, I would like to see if I could do it my self first, just need a bit of guidance
Mobile doesn’t support hover, so perhaps you should rethink this? Users on mobile would have to tap the images. Do you plan on linking these brides to another page anytime in the future?
“Do you plan on linking these brides to another page anytime in the future”,
no not on the page i’ve been working on. This page is a kind off inner page showing examples of a wedding.
But on the home page yes the grid would need to click through to an associated inner page, originally i used the below as my home page but then the grid layout gets bent out of shape wjth different viewport sizes so ended up working on what we’ve got now, http://codepen.io/Pingbat/pen/xbBQqE
Maybe the home page could use this grid which i like but just does not have hover over enlarged images and is hyperlinked thrrough to the relevant wedding.