* { 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
Okay, let's break down this CSS code snippet. It defines the styling for a visually engaging, modern-looking portfolio website, likely for a photographer, designer, or creative professional.
Here's a breakdown of its key components and effects:
-
Global Reset and Base Styles:
* { margin: 0; padding: 0; box-sizing: border-box; }: This is a standard reset. It removes default browser margins and paddings and setsbox-sizingtoborder-box. This makes element sizing more intuitive, as padding and borders are included within the element's specified width and height.body { ... }: Sets the default background to black (#000), specifies the 'Helvetica Now' font (or a generic sans-serif fallback), and importantly,overflow-x: hidden;prevents horizontal scrolling at the body level, even if content tries to overflow.
-
Hero Section (Fullscreen Auto-Scrolling Gallery):
.hero { ... }: Defines a container that takes up the full viewport height (height: 100vh) and width (width: 100%).position: relative;allows absolute positioning of child elements (like the overlay) relative to it.overflow: hidden;ensures content overflowing the hero section itself is clipped..auto-scroll-gallery { ... }:- Uses
display: flex;to arrange its children (the images) in a row horizontally. width: max-content;allows the container to grow horizontally to fit all the images side-by-side, exceeding the viewport width.animation: scroll 25s linear infinite;applies a continuous, linear animation namedscrollthat lasts 25 seconds and repeats infinitely. This creates the auto-scrolling effect.
- Uses
.auto-scroll-gallery img { ... }:- Styles the images within the gallery to be fullscreen (
100vwwidth,100vhheight). object-fit: cover;ensures the images cover the entire area without distortion, cropping if necessary.filter: brightness(0.7);darkens the images slightly, making overlaid text more readable.
- Styles the images within the gallery to be fullscreen (
@media (hover: hover) { .auto-scroll-gallery:hover { animation-play-state: paused; } }: A nice touch for desktop users – the auto-scroll animation pauses when the user hovers their mouse over the gallery. This media query prevents this behaviour on touch devices where hover isn't applicable in the same way.
-
Overlay Content (Logo and Button):
.overlay { ... }:position: absolute;places it on top of the.herocontainer, covering it completely (top: 0; left: 0; width: 100%; height: 100%;).display: flex; flex-direction: column; justify-content: space-between;arranges its children (logo and button) vertically, pushing the logo towards the top and the button towards the bottom.padding: 2rem;adds spacing around the edges.pointer-events: none;is crucial – it makes the overlay itself non-interactive, allowing clicks and hovers to pass through to the underlying gallery except for elements that explicitly re-enable pointer events.
.logo { ... }: Styles the logo text (white, large, uppercase, letter spacing, subtle text shadow)..contact-btn { ... }:pointer-events: auto;overrides the overlay'snone, making the button clickable.align-self: flex-end;aligns the button to the right within the flex container (the overlay).- Styles the button with a prominent red background (
#ff0000), white text, padding, border-radius, etc. cursor: pointer;indicates it's clickable.- Includes a subtle hover effect (
transform: translateY(-3px); box-shadow: ...;) making the button lift slightly.
-
Secondary Portfolio Grid:
.portfolio { padding: 2rem; }: Adds padding around the grid section..grid { ... }:- Uses
display: grid;to create a grid layout. grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));creates a responsive grid. Columns will be at least 300px wide. As many columns as fit will be created (auto-fit), and any remaining space will be distributed equally among them (1fr).gap: 1rem;adds spacing between grid items.
- Uses
.grid-item { ... }: Container for each portfolio piece.position: relative;for the absolute positioned overlay text.overflow: hidden;clips the image zoom effect..grid-item img { ... }: Styles the images within the grid (full width/height of the item, cover). Includes atransitionfor a smooth zoom effect on hover..grid-item:hover img { transform: scale(1.05); }: Makes the image slightly larger when its container (.grid-item) is hovered..overlay-text { ... }:- An absolutely positioned text overlay at the bottom of each grid item.
- Initially hidden below the item (
transform: translateY(100%);). transition: transform 0.3s;ensures a smooth slide-up effect.- Styles the text overlay (semi-transparent black background, white text).
.grid-item:hover .overlay-text { transform: translateY(0); }: Makes the overlay text slide into view when the grid item is hovered.
-
Mobile Responsiveness (
@media (max-width: 768px)):- Targets screens 768px wide or smaller.
.auto-scroll-gallery: Changesflex-directiontocolumnand applies a different animation (scroll-mobile) for vertical scrolling on mobile..auto-scroll-gallery img: Image dimensions remain fullscreen..contact-btn: Centers the button (align-self: center;) and makes it slightly smaller..grid: Forces the grid into a single column (grid-template-columns: 1fr;).
-
Keyframes (Animations):
@keyframes scroll { ... }: Defines the horizontal movement for the desktop hero gallery usingtranslateX. The calculationcalc(-100% + 100vw)scrolls the content leftwards until the start of the last image aligns with the left edge of the viewport (effectively showing all images sequentially).@keyframes scroll-mobile { ... }: Defines the vertical movement for the mobile hero gallery usingtranslateY. Similar logic applies, scrolling upwards.
In Summary:
This CSS creates a two-part portfolio layout:
- A striking, full-screen hero section featuring an auto-scrolling image gallery (horizontal on desktop, vertical on mobile) with a darkened effect for text readability. An overlay contains a logo and a prominent red contact button. The gallery pauses on hover (desktop).
- A secondary section below displays portfolio items in a responsive grid. Hovering over grid items zooms the image slightly and reveals a text description overlay that slides up from the bottom.
The overall aesthetic is dark, modern, and interactive, relying heavily on visual impact through large imagery and smooth animations/transitions.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.