✨ 999 个小技巧,让你 Vibe 的产品更有质感 - 第 23 期 做好移动端网页适配的 4 个 Tips (附改造 Prompt,可以直接抄⬇️) 1. 去掉 iOS 的点击高亮。WebKit 会在点过的地方盖一块深色,悬停样式也会停住,元素看起来在闪、在跳。关掉高亮,悬停只留给鼠标。 2. 把顶部 Tab 移到底部。拇指常用的区域在屏幕下方。底部 Tab 随滚动收起和展开:往下读时收成小胶囊,往上滚或点一下再展开。 3. 做好 Safari 状态栏和工具栏的取色。 Safari 会读贴着屏幕顶边和底边的那一层来上色:状态栏想接上页面顶部的颜色;弹窗遮罩、底栏不要固定在窗口上,否则工具栏后面会多出一条灰带。 4. 如果有条件,支持 PWA。让用户能把网页添加到桌面,像 App 一样打开。 https://vibedesign.tips/023-mobile-web/
枯白啃设计

图标设计师 / 设计工程师

Prompt(4/4) b. Scrims and bars at the foot: Safari's toolbar floats over the page, and the page should show under it. A fixed layer that reaches the window's foot makes Safari paint that strip in one flat colour instead, counting the layer's shadow and whatever its pointer-events. - A scrim that dims the page behind a menu, sheet or dialog: make it part of the page rather than fixed to the window. Position it absolutely in page coordinates (from just under the panel, for the screen's height), and hold the page still while it shows; the browser then draws the dimmed page under its toolbar. - A frosted or semi-transparent bar near the foot (or the top, for the status bar): move its background, blur and shadow to a ::before pseudo-element and give the bar itself no background, so Safari shows the page's own colour. c. Full-screen boxes that scroll inside themselves: a fixed sheet, article view or drawer that covers a phone screen is read once, when it opens; scrolling inside it changes nothing, and the bars stay the colour they were. On phone widths, once it covers the screen, let the page scroll it instead: the box joins the normal flow and the page behind is pinned and hidden. Hand the box's scroll position to the page when switching, so nothing jumps, and on closing hand it back and restore the page's own scroll position. Tablets and desktops keep the inner scroll. This is a larger change: describe it and ask before making it. d. Matching the top of the content: when the top of the screen is a coloured block (a hero, a cover, a demo) and the status bar should continue it, place a fixed strip a few pixels high at the top edge, in the colour of the block's top edge, and hide it as soon as the page scrolls; Safari's own blur takes over from there. Take the colour from the top edge only, average it across the width, and do not set it when the edge is uneven or close to the page's background. Offer this; do not add it unasked. e. Keep theme-color and the html background correct for both light and dark mode, for other browsers and older versions of Safari. f. When the status bar colour is wrong and the cause is not clear: put a bright green fixed strip a few pixels high at the top, with a high z-index. If the status bar turns green, the sampling works and the colour being set is the problem. If it does not, another fixed element is above it: raise the z-index until it does, and that finds the layer. 5. Report before changing anything Give me a table first, and do not change code yet. One row per problem: - Where: the file and selector, or the component. - Now: what a person sees on a phone or an iPad (a dark box larger than the button, a control that stays wide after a tap, a white status bar over the hero, a grey toolbar, a colour that stays after closing a page). - Cause: which rule above. - Fix: the change, and anything it could affect on desktop. Group the rows by area (opening as an app, taps, bars at the foot, status bar and toolbar). Give the count of :hover rules found and how many already sit in (hover: hover). Wait for me to choose what to change. 6. Change what I approve - Keep the look on desktop exactly as it is: hover with a mouse still works, focus rings are unchanged. - Keep each component's own logic; move only the styles and layers involved. - Leave a short comment where a rule exists only for Safari, saying what it prevents. 7. Check - Add the site to the home screen (Safari's Share, then Add to Home Screen, on the iOS Simulator; Chrome's install on Android or a computer): the icon is sharp, the name fits, it opens without the browser's bars, the shortcuts work, and pages already visited open offline. - Test on the iOS Simulator that comes with Xcode, in Safari: an iPhone, and an iPad in landscape (wider than 1024px). Its status bar and toolbar take colours the way a real device does. Confirm on a real phone at the end. - Test the production build, served locally, not only the dev server: scripts and styles injected at build time can add fixed layers the dev server does not have. - Tap every control that has a hover style: no dark box, nothing changes size or position, and :active still shows while pressed. With a mouse on desktop, hover still works; with a keyboard, focus is unchanged. - List every remaining :hover outside (hover: hover) and say why each stays. - Open and close each full-screen layer and sheet, scroll, and switch between pages of different colours: the status bar and toolbar follow, and nothing stays until a reload. - Scroll each page with a bar at the foot down and up, slowly and in quick flicks: the bar folds and opens without flickering, and its capsule stays in the screen's middle. - Light and dark mode, a narrow phone and a short one (375 × 667).
登录并发表评论

评论 · 0