Blogs

Centering a div That Maintains Aspect-Ratio When There's Body Margin

Css Tricks

Andrew Welch had a little CSS challenge the other day to make an ordinary div: • centered vertically + horizontally • scales to fit the viewport w/ a margin around it • maintains an arbitrary aspect ratio • No JS There’s a video in that tweet if it helps you visualize the challenge.

Visit Site

Centering a div That Maintains Aspect-Ratio When There's Body Margin
Some Things You Oughta Know When Working with Viewport UnitsCss Tricks Unsuck It | CSS-TricksCss Tricks Responsive Iframes | CSS-TricksCss Tricks Finally... A Post on Finally in Promises | CSS-TricksCss Tricks Weekly news: Truncating muti-line text, calc() in custom property values, Contextual AlternatesCss Tricks What the Web Needs Now (and how ARTIFACT is here for it)Css Tricks Publish changes - MintlifyMintlify How we grew Mintlify by doing things that don't scaleMintlify Mintlify Alternatives: What to Consider (and Why There's No True Substitute)Mintlify Six Things to Consider When Using Redis on HerokuRedis Workato integrations: What's included and when to use ZapierZapier 6 ways to use the Zapier Zoho CRM integrationZapier Get email alerts for Facebook Messenger messagesZapier Grafana Is Not Worried About AWS CommercializationThenewstack When CI Meets CD: Deliver With ConfidenceThenewstack Managing dependencies - The Go Programming LanguageGo What is a Streaming Multiprocessor?Modal System UIconsCss Tricks The Serverless Backend for Analytics: Introducing MotherDuck’s Native Integration on VercelMotherduck Config and Secret environment variablesVercel