* { margin: 0; padding: 0; box-sizing: border-box; } body { background: #000;…
- User
- { margin: 0; padding: 0; box-sizing: border-box; }
body { background: #000; font-family: 'Helvetica Now', sans-serif; overflow-x: hidden; /* Prevent horizontal scroll */ }
/* Hero Section */ .hero { position: relative; width: 100%; height: 100vh; overflow: hidden; }
.auto-scroll-gallery { display: flex; animation: scroll 25s linear infinite; /* Adjust speed here / width: max-content; / Allow horizontal overflow */ }
.auto-scroll-gallery img { width: 100vw; /* Fullscreen width / height: 100vh; / Fullscreen height / object-fit: cover; / Maintain aspect ratio / filter: brightness(0.7); / Darken images for better text readability */ }
/* Pause auto-scroll on hover (desktop only) */ @media (hover: hover) { .auto-scroll-gallery:hover { animation-play-state: paused; } }
.overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; padding: 2rem; pointer-events: none; /* Let clicks pass through to gallery */ }
.logo { color: #fff; font-size: 2rem; text-transform: uppercase; letter-spacing: 0.2rem; text-shadow: 0 0 10px rgba(0, 0, 0, 0.5); }
.contact-btn { pointer-events: auto; /* Make button clickable / align-self: flex-end; background: #ff0000; / Heavy red accent */ color: #fff; padding: 1rem 2rem; border: none; border-radius: 2px; font-size: 1rem; text-transform: uppercase; cursor: pointer; transition: transform 0.2s; }
.contact-btn:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(255, 0, 0, 0.3); }
/* Secondary Portfolio Grid */ .portfolio { padding: 2rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.grid-item { position: relative; overflow: hidden; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.grid-item:hover img { transform: scale(1.05); }
.overlay-text { position: absolute; bottom: 0; left: 0; width: 100%; padding: 1rem; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 0.9rem; transform: translateY(100%); transition: transform 0.3s; text-align: center; }
.grid-item:hover .overlay-text { transform: translateY(0); }
/* Mobile Responsiveness */ @media (max-width: 768px) { .auto-scroll-gallery { flex-direction: column; animation: scroll-mobile 20s linear infinite; }
.auto-scroll-gallery img { width: 100vw; height: 100vh; }
.contact-btn { align-self: center; font-size: 0.9rem; padding: 0.8rem 1.5rem; }
.grid { grid-template-columns: 1fr; } }
/* Auto-Scroll Keyframes / @keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(calc(-100% + 100vw)); / Scroll to the end of the gallery */ } }
@keyframes scroll-mobile { 0% { transform: translateY(0); } 100% { transform: translateY(calc(-100% + 100vh)); /* Scroll vertically on mobile */ } }
Assistant
The provided CSS code creates a full-screen auto-scrolling image gallery with responsive design and hover interactions. Here's a breakdown of its key components and functionality:
Core Features
-
Auto-Scrolling Gallery
- Uses CSS animations (
scrollandscroll-mobile) to create infinite horizontal scrolling on desktop and vertical scrolling on mobile[[1]][[6]]. - Images are set to
width: 100vwandheight: 100vhfor full-screen coverage[[1]][[6]]. - Pause on hover via
animation-play-state: paused(desktop only)[[1]][[8]].
- Uses CSS animations (
-
Responsive Design
- Mobile layout switches to vertical scrolling using
flex-direction: columnand adjusted keyframes[[3]][[6]]. - Grid layout (
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))) adapts to screen size[[3]].
- Mobile layout switches to vertical scrolling using
-
Visual Enhancements
- Darkened images (
filter: brightness(0.7)) improve text readability[[1]]. - Hover effects on portfolio grid items (image scaling and overlay text reveal)[[3]][[6]].
- Animated contact button with hover transitions[[1]][[8]].
- Darkened images (
Key CSS Techniques
/* Horizontal scroll animation */ @keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(calc(-100% + 100vw)); } } /* Vertical scroll for mobile */ @media (max-width: 768px) { .auto-scroll-gallery { flex-direction: column; animation: scroll-mobile 20s linear infinite; } }
Potential Issues & Fixes
-
Missing Keyframes
Thescroll-mobileanimation is defined but not shown in the provided code. Add:@keyframes scroll-mobile { 0% { transform: translateY(0); } 100% { transform: translateY(calc(-100% + 100vh)); } } -
Image Duplication
For seamless infinite scrolling, duplicate images in the HTML structure (as shown in [[1]][[5]]). -
Performance
Consider addingwill-change: transformto.auto-scroll-galleryfor smoother animations[[1]][[6]].
Comparison to Search Results
Feature Your Code Search Results Scroll Direction Horizontal/mobile Horizontal[[1]][[6]] Animation CSS keyframes CSS[[1]][[5]], JS[[7]][[8]] Responsiveness Media queries Flexbox[[3]], Grid[[3]] Hover Effects Pause animation Hover states[[1]][[8]] For a pure CSS solution, your approach is efficient. For more control (e.g., touch support), consider JavaScript libraries like Slick Slider[[7]][[8]].
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.