惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
有赞技术团队
有赞技术团队
WordPress大学
WordPress大学
博客园 - 司徒正美
D
Docker
B
Blog
V
Visual Studio Blog
Blog — PlanetScale
Blog — PlanetScale
U
Unit 42
S
SegmentFault 最新的问题
小众软件
小众软件
J
Java Code Geeks
美团技术团队
腾讯CDC
MyScale Blog
MyScale Blog
爱范儿
爱范儿
H
Help Net Security
宝玉的分享
宝玉的分享
Microsoft Azure Blog
Microsoft Azure Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Responsive Grid Layouts for Browser Extension New Tab Pages
Weather Cloc · 2026-05-04 · via DEV Community

Weather Clock Dash

Responsive Grid Layouts for Browser Extension New Tab Pages

When building the Weather & Clock Dashboard Firefox extension, one of the tricky challenges was making the layout work well across different monitor sizes and resolutions.

Browser extension new tab pages have a unique constraint: you cannot control the viewport size. Users might have a 1080p monitor, a 4K display, or a small laptop screen.

The Base Grid

I use CSS Grid for the main layout:

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

Enter fullscreen mode Exit fullscreen mode

auto-fit with minmax gives you:

  • 1 column on narrow viewports (< 560px)
  • 2 columns on medium screens
  • 3+ columns on wide screens

All without a single media query.

Cards That Scale

.card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 20px;
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

/* Weather card takes full width on small screens */
@media (min-width: 768px) {
  .weather-card {
    grid-column: span 2;
  }
}

Enter fullscreen mode Exit fullscreen mode

World Clocks: Auto-Wrapping Row

For the world clocks section specifically:

.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

Enter fullscreen mode Exit fullscreen mode

auto-fill (vs auto-fit) keeps empty columns at minimum width, which is useful when you have a fixed number of clocks and want them to stay left-aligned rather than stretching.

Centering the Whole Page

For a new tab page, you want the content centered both horizontally and vertically:

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 16px;
  box-sizing: border-box;
}

.dashboard {
  width: 100%;
  max-width: 1200px;
}

Enter fullscreen mode Exit fullscreen mode

min-height: 100vh with flex centering ensures the content is centered even if the page is taller than the viewport (which can happen on very small screens).

The Font Size Issue

Big clock digits need to scale with the card width, not the viewport:

.clock-time {
  font-size: clamp(1.5rem, 4vw, 3rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

Enter fullscreen mode Exit fullscreen mode

clamp(min, preferred, max) sets bounds on the scaling:

  • Never smaller than 1.5rem
  • Scales with viewport width (4vw)
  • Never larger than 3rem

Testing Across Resolutions

The easiest way to test your new tab page across resolutions is to use Firefox's Responsive Design Mode (Ctrl+Shift+M in DevTools). Test at:

  • 1280x720 (13" laptop)
  • 1920x1080 (standard desktop)
  • 2560x1440 (27" display)
  • 3840x2160 (4K)

The Weather & Clock Dashboard source uses all these techniques.