body {
background: f8f9fa;
margin: 0;
padding: 20px;
fontfamily: Arial, sansserif;
}
h1 {
textalign: center;
marginbottom: 30px;
}
.gallery {
display: grid;
gridtemplatecolumns: repeat(autofit, minmax(300px, 1fr));
gridgap: 20px;
padding: 20px;
}
.imagebox {
border: 1px solid ddd;
padding: 10px;
textalign: center;
cursor: pointer;
}
.imagebox img {
maxwidth: 100%;
marginbottom: 10px;
}
.description {
margintop: 10px;
textalign: justify;
}
a {
color: 4285F4;
textdecoration: none;
}
a:hover {
textdecoration: underline;
}
大餐美食图片展示
function openImage(index) {
var gallery = document.querySelector('.gallery');
gallery.style.display = 'flex';
gallery.style过渡 = 'transform 0.3s easeinout';
gallery.children[index].style.transform = 'scale(1.1)';
gallery.children[index].classList.add('active');
setTimeout(() => {
gallery.style.transform = 'none';
}, 500);
}