Get the latest tech news

Styling an HTML dialog modal to take the full height of the viewport


I've been experimenting with the HTML dialog element recently, for example in my Prompts.js JavaScript library.

I got Claude 3.7 Sonnet to rewrite the code to use a div instead of a dialog and the mysterious gap vanished, which was a strong hint that she was right. Natalie pointed out that Chrome DevTools display default browser styles for elements, so we switched to that and... That commit landed in November 2020, and those linked issue threads have all sorts of details about how this change came about.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of height

height

Photo of viewport

viewport

Photo of HTML dialog modal

HTML dialog modal

Related news:

News photo

Did You Know iPhones Can Measure a Person's Height? Here's How

News photo

Finland’s 100MW sand battery turns 2,000 tons of fireplace waste into power | In terms of size, this unique battery will have a height of about 13 meters and a width of roughly 15 meters.

News photo

When railroad dining cars were the height of luxury