Skip to content

Commit 0d03f99

Browse files
committed
Refine responsive hero placement
1 parent a6a8808 commit 0d03f99

2 files changed

Lines changed: 39 additions & 30 deletions

File tree

‎src/index.css‎

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,9 @@
192192
}
193193

194194
.hero-content {
195-
min-height: 44rem;
196195
align-items: flex-start;
197196
padding-top: 3.5rem;
198-
padding-bottom: 20rem;
197+
padding-bottom: 0;
199198
}
200199

201200
.hero-copy {
@@ -204,26 +203,15 @@
204203
}
205204

206205
.hero-science-field {
207-
position: absolute;
208-
bottom: -2rem;
209-
left: 50%;
206+
position: relative;
210207
z-index: 1;
211-
width: min(135vw, 44rem);
208+
width: min(118vw, 34rem);
209+
margin-top: 1rem;
210+
margin-right: -8vw;
211+
margin-bottom: -2.5rem;
212+
margin-left: auto;
212213
pointer-events: none;
213214
opacity: 0.78;
214-
transform: translateX(-50%);
215-
-webkit-mask-image: radial-gradient(
216-
ellipse 78% 76% at 60% 48%,
217-
#000 0 54%,
218-
rgb(0 0 0 / 92%) 72%,
219-
transparent 100%
220-
);
221-
mask-image: radial-gradient(
222-
ellipse 78% 76% at 60% 48%,
223-
#000 0 54%,
224-
rgb(0 0 0 / 92%) 72%,
225-
transparent 100%
226-
);
227215
}
228216

229217
.dark .hero-science-field {
@@ -305,34 +293,54 @@
305293
}
306294
}
307295

296+
@media (min-width: 480px) {
297+
.hero-science-field {
298+
width: min(108vw, 40rem);
299+
margin-top: 1.5rem;
300+
margin-right: -7vw;
301+
}
302+
}
303+
308304
@media (min-width: 640px) {
309305
.hero-content {
310-
min-height: 54rem;
311306
padding-top: 4rem;
312-
padding-bottom: 27rem;
313307
}
314308

315309
.hero-science-field {
316-
bottom: -3rem;
317-
width: min(110vw, 52rem);
310+
width: min(100vw, 46rem);
311+
margin-top: 2rem;
312+
margin-right: -6vw;
318313
}
319314
}
320315

321316
@media (min-width: 1024px) {
322317
.hero-content {
323-
min-height: 40rem;
318+
min-height: 42rem;
324319
align-items: center;
325320
padding-top: 6rem;
326321
padding-bottom: 6rem;
327322
}
328323

329324
.hero-science-field {
325+
position: absolute;
330326
top: 50%;
331-
bottom: auto;
332-
left: calc(50% - 5rem);
333-
width: min(72vw, 76rem);
327+
right: clamp(-4rem, -3vw, -2rem);
328+
width: min(60vw, 64rem);
329+
margin: 0;
334330
opacity: 0.9;
335331
transform: translateY(-50%);
332+
-webkit-mask-image: linear-gradient(
333+
90deg,
334+
transparent 0,
335+
#000 10%,
336+
#000 100%
337+
);
338+
mask-image: linear-gradient(
339+
90deg,
340+
transparent 0,
341+
#000 10%,
342+
#000 100%
343+
);
336344
}
337345

338346
.dark .hero-science-field {

‎src/pages/Home.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ const Home = () => (
2727
<div>
2828
<section className="hero-shell relative isolate overflow-hidden border-b border-border bg-background">
2929
<div className="absolute inset-0 z-0 bg-lab-grid" aria-hidden="true" />
30-
<div className="hero-science-field" aria-hidden="true">
31-
<HeroScienceGraphic className="w-full" />
32-
</div>
3330

3431
<div className="hero-content relative z-10 mx-auto flex max-w-6xl px-4 sm:px-6 lg:px-8">
3532
<div className="hero-copy max-w-[36rem]">
@@ -58,6 +55,10 @@ const Home = () => (
5855
</div>
5956
</div>
6057
</div>
58+
59+
<div className="hero-science-field" aria-hidden="true">
60+
<HeroScienceGraphic className="w-full" />
61+
</div>
6162
</section>
6263

6364
<section className="mx-auto max-w-6xl px-4 py-16 sm:px-6 md:py-20 lg:px-8">

0 commit comments

Comments
 (0)